internationalization

Gettext to work with context (pgettext)

不打扰是莪最后的温柔 提交于 2019-12-11 12:53:54
问题 I'd like to use pgettext to specify the context of some strings to translate, I've found that you need to add it yourself in PHP, which is what I did following this post's instructions. I've changed it a little bit to make it work (the dcgettext function call had some errors): function pgettext($context, $msgid) { $contextString = "{$context}\004{$msgid}"; $translation = dcgettext('messages', $contextString, 5); if ($translation == $contextString) return $msgid; else return $translation; }

How to change the default message.properties

喜夏-厌秋 提交于 2019-12-11 12:40:25
问题 Let's say we have the following line of code: <p> <g:message code="nav.usuario.show" /> </p> If we are using an italian computer, Grails will look at messages_it.properties first. If grails desn't find nav.usuario.show=textLabel there, will try to find it in messages.properties . I want to change this behavior to look at message_es.properties instead the default messages.properties (but only if the label is not in the current locale language ) I tried the following code, but I didn't see any

Coding a menu that allows user to select a language

…衆ロ難τιáo~ 提交于 2019-12-11 12:17:16
问题 How would I go about coding a menu that will allow the user to select a language and thereafter the user will have his whole program rendered in the language of his choice? Note: I'm using Netbeans and one of the tutorials suggested using automatic internalization to make the bundle.properties files. What I don't know is how to set the language to selected option. Please explain in detail as I can barely understand what I'm doing right now. int sel = cmbLang.getSelectedIndex(); switch (sel) {

How to deal with DjangoCMS i18n URLs (/en/my_page, /fr/my_page…) and AngularJS?

六眼飞鱼酱① 提交于 2019-12-11 12:12:07
问题 I'm trying to learn AngularJS and DjangoCMS so I created a new project using them together. Status By default, DjangoCMS uses the first URL segment to determine the language of the site (/en/, /fr/). Every URL that doesn't contain a language segment will get redirected to /en/ by default. That means, all my AngularJS ajax calls need to be addressed to either /en/api/ or /fr/api/. Questions I'd like to use this first segment to determine the language in Angular for internationalization. And

mb_strtolower doesn't work with french vowel é

偶尔善良 提交于 2019-12-11 12:07:01
问题 I have a PHP function, which delete the last letter of $word_one and put an apostroph to this word, when the $word_two begins with a vowel. But with the french vowel é it doesn't work, although I use the mb_strtolower with , 'UTF-8' . I don't want to change the $pers array, because I have also combination for words where the $word_two doesn't begin with a vowel. function French($word_one, $word_two) { if (in_array(mb_strtolower($word_two{0}, 'UTF-8'), array('a', 'e', 'é', 'i', 'o')) and (

C++ writing UTF-8 on Linux

半腔热情 提交于 2019-12-11 11:36:35
问题 I have the following code on Windows written in C++ with Visual Studio: FILE* outFile = fopen(outFileName, "a,ccs=UTF-8"); fwrite(buffer.c_str(), buffer.getLength() * sizeof(wchar_t), 1, outFile); std::wstring newLine = L"\n"; fwrite(newLine.c_str(), sizeof(wchar_t), 1, outFile); fclose(outFile); This correctly writes out the file in UTF-8. When I compile and run the same code on Linux, the file is created, but it is zero length. If I change the fopen command as follows, the file is created

Django not translating the site properly

☆樱花仙子☆ 提交于 2019-12-11 11:34:42
问题 After spending too many hours on this, StackOverflow is for the rescue. I configured my settings.py as below: ... TIME_ZONE = 'Europe/Berlin' LANGUAGE_CODE = 'de' LANGUAGES = ( ('en', u'English'), ('de', u'German'), ('fr', u'French'), ) USE_I18N = True USE_L10N = True MIDDLEWARE_CLASSES = ( 'django.middleware.locale.LocaleMiddleware', 'django.middleware.common.CommonMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django

How to apply i18n on whole website by a single click in Struts 2

落花浮王杯 提交于 2019-12-11 11:06:56
问题 Is it possible to apply Struts 2 Internationalization (i18n) for changing language from English to Hindi on whole web pages of website by single click? If it is possible then how can I resolve this problem? 回答1: The framework is internationalized. You need to add the corresponding to each locale resource bundles for the localized messages that you display via the struts tags. Use text tag or getText() to retrieve a message in the UI. The browser language is passed with the HTTP request and

grails g:select i18n

坚强是说给别人听的谎言 提交于 2019-12-11 11:06:35
问题 I just read a lot and googled but I'm frustrated right now. I have a Country domain model class Country{ String countryCode //maybe EN, DE, CH... } Now I want a translation inside the . I read in the documentation (and with google) that it is possible with the "id" to select it from the translation message property files. Something like: country.code.1=America country.code.2=England country.code.3=Germany But this is not what I want. I want to have something like: country.code.US=America

human_attribute_name and translation files in rails

a 夏天 提交于 2019-12-11 10:46:56
问题 I am running a site w/ English and Spanish translation files, with the English as the default. Using translations such as: en: tenants: about: "About" to es: tenants: about: "Acera" Using t "tenants.about" Works without issue and reads properly from either the en.yml and es.yml files when appropriate. However, when trying to use the human_attribute_name property to pull model attributes from another section of the spanish es.yml file, the values are not being read. So something like Job.human