translation

Symfony2 & Translatable : entity's locale is empty

心不动则不痛 提交于 2019-12-22 12:24:33
问题 I am trying to display a list of categories with Translatable behavior. My default locale is 'fr'. In my 'ext_translations' table, I have all records needed for locale 'en'. My controller : .... $this->get('session')->setLocale('en'); $categories = $this->getDoctrine()->getRepository('MyBundle:Category')->findAll(); .... The problem is that when I display all retrieved categories, I get the 'fr' translations instead of the 'en'. I tried to display the $locale variable from my Category entity,

Symfony2 & Translatable : entity's locale is empty

*爱你&永不变心* 提交于 2019-12-22 12:24:05
问题 I am trying to display a list of categories with Translatable behavior. My default locale is 'fr'. In my 'ext_translations' table, I have all records needed for locale 'en'. My controller : .... $this->get('session')->setLocale('en'); $categories = $this->getDoctrine()->getRepository('MyBundle:Category')->findAll(); .... The problem is that when I display all retrieved categories, I get the 'fr' translations instead of the 'en'. I tried to display the $locale variable from my Category entity,

What is the best way to store multiple language versions of a website?

百般思念 提交于 2019-12-22 10:39:31
问题 My web site (on Linux servers) needs to support multiple languages. What is the best practice to have/store multiple languages versions of the same site? Some I can think of: store in DB different view file for each language gettex hard coded words in PHP files (like in phpBB) 回答1: With web sites, you really have several categories of content to consider for localization: The article-type content elements that you would in many cases create, edit and publish in a CMS. The smaller content

Django i18n not recognizing language files

╄→гoц情女王★ 提交于 2019-12-22 09:00:10
问题 On Django 1.4, I want to have two languages in my site, turkish('tr') and english('en'). This is my current setup: settings.py: USE_I18N = True LANGUAGES = ( ('en', 'English'), ('tr', 'Turkish'), ) MIDDLEWARE_CLASSES = ( 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.locale.LocaleMiddleware', # I have locale middleware 'django.middleware.common.CommonMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware',

Django Translation not working even with LOCALE_PATHS

有些话、适合烂在心里 提交于 2019-12-22 07:59:13
问题 So I'm using django 1.8 to create a new web site that has to be translated into portuguese. So to use django's own tools I added to my middlewares: 'django.middleware.locale.LocaleMiddleware', I also added to my context_processors: 'django.template.context_processors.i18n', and the i configure my language settings: USE_I18N = True gettext = lambda s: s LANGUAGE_CODE = 'en' LOCALE_PATHS = ( os.path.join(BASE_DIR, 'locale'), ) print LOCALE_PATHS LANGUAGES = ( ('pt-br', gettext('Portuguese')), (

put new line in string to translate

北慕城南 提交于 2019-12-22 06:48:22
问题 I'm using ngx-translate. How can I put a line break in a string to translate ? In my template I have : {{'STRING_TO_TRANSLATE' | translate}} In my en.json: { "STRING_TO_TRANSLATE": "text on first line. <br> or \n don't work. Text on second line" } 回答1: It works! But instead of {{'STRING_TO_TRANSLATE' | translate}} You should do <div [innerHTML]="'STRING_TO_TRANSLATE' | translate"></div> <br/>s should work just fine, but in other cases you may need some additional 'safe html pipe', i.e: import

How to get localized values from Facebook Open Graph API through Koala?

一世执手 提交于 2019-12-22 06:22:11
问题 I am using the koala gem in my rails app to use the Facebook Open Graph API. The primary language of the app is German. Is there a way to set a locale to get e.g. the user's current city in German? Or is there another reliable wa to translate locations? 回答1: The Graph API supports the passing of the locale parameter. For Germany, this would be de_DE . You can test this via GET /me?fields=location&locale=de_DE compared to GET /me?fields=location&locale=en_GB Have a look at https://developers

Babel doesn't recognize jinja2 extraction method for language support

╄→гoц情女王★ 提交于 2019-12-22 05:58:12
问题 I'm adding language translation support to my project. The code is on Python and has jinja2 in the html files, and Javascript. I'm trying to use Babel to do the translation, but it doesn't recognize the extraction method of jinja2. Maybe I'm using an incorrect name for it. This is my ini file: # Extraction from Python source files [python: **.py] # Extraction from Jinja2 template files [jinja2: **.html] # Extraction from JavaScript files [javascript: **.js] extract_messages = $._, jQuery._

Is there a tool for non-developers (translators!) to edit resource bundles?

二次信任 提交于 2019-12-22 05:35:11
问题 What we do in our company to let our software be translated by external translators is ... well .. how to put it... cvs co someModule ant translation.export (behind this target there is a self-made ant task, exporting all resource bundles together as one big tab-seperated text file, columns: the different languages, each row all languages for one key) Some VB tool does something with the file (you don't wanna know) Translators work in Excel on their column Someone collects and merges the

What is a Ruby equivalent for Python's “zip” builtin?

[亡魂溺海] 提交于 2019-12-22 01:38:16
问题 Is there any Ruby equivalent for Python's builtin zip function? If not, what is a concise way of doing the same thing? A bit of context: this came up when I was trying to find a clean way of doing a check involving two arrays. If I had zip , I could have written something like: zip(a, b).all? {|pair| pair[0] === pair[1]} I'd also accept a clean way of doing this without anything resembling zip (where "clean" means "without an explicit loop"). 回答1: Ruby has a zip function: [1,2].zip([3,4]) =>