internationalization

French translation raises “ValueError('invalid token in plural form: %s' % value)”

半腔热情 提交于 2020-03-22 04:01:05
问题 I want to handle a french version of my website. I use Django 2.2 with i18n and I already set locale variables in settings.py. # Internationalization # https://docs.djangoproject.com/en/2.2/topics/i18n/ LANGUAGES = ( ('en', _('English')), ('fr', _('French')), ('it', _('Italian')), ('es', _('Spanish')), ) LOCALE_PATHS = ( os.path.join(BASE_DIR, 'locale'), ) TIME_ZONE = 'Europe/Paris' USE_I18N = True USE_L10N = True USE_TZ = True When I use ./manage.py makemessages -l fr , I correctly have a

Translating %% with gettext and jinja2 and pyramid

混江龙づ霸主 提交于 2020-02-22 08:11:04
问题 Doing i18n work with Python using Jinja2 and Pyramid. Seems to have a problem knowing how it should translate %%. I'm beginning to suspect the bug is in Jinja2. So I've done some more investigation and it appears the problem is more with gettext than with jinja2 as illustrated with the repl >>>gettext.gettext("98%% off %s sale") % ('holiday') '98% off holiday sale' >>>gettext.gettext("98%% off sale") '98%% off sale' >>>gettext.gettext("98% off %s sale") % ('holiday') Traceback (most recent

Translating %% with gettext and jinja2 and pyramid

我是研究僧i 提交于 2020-02-22 08:07:54
问题 Doing i18n work with Python using Jinja2 and Pyramid. Seems to have a problem knowing how it should translate %%. I'm beginning to suspect the bug is in Jinja2. So I've done some more investigation and it appears the problem is more with gettext than with jinja2 as illustrated with the repl >>>gettext.gettext("98%% off %s sale") % ('holiday') '98% off holiday sale' >>>gettext.gettext("98%% off sale") '98%% off sale' >>>gettext.gettext("98% off %s sale") % ('holiday') Traceback (most recent

Translating %% with gettext and jinja2 and pyramid

蹲街弑〆低调 提交于 2020-02-22 08:04:33
问题 Doing i18n work with Python using Jinja2 and Pyramid. Seems to have a problem knowing how it should translate %%. I'm beginning to suspect the bug is in Jinja2. So I've done some more investigation and it appears the problem is more with gettext than with jinja2 as illustrated with the repl >>>gettext.gettext("98%% off %s sale") % ('holiday') '98% off holiday sale' >>>gettext.gettext("98%% off sale") '98%% off sale' >>>gettext.gettext("98% off %s sale") % ('holiday') Traceback (most recent

GetUserPreferredUILanguages() never returns more than two languages

﹥>﹥吖頭↗ 提交于 2020-02-21 11:12:29
问题 I'm trying to retrieve the complete list of the user's preferred languages from a C++/Qt application, as configured in the "Region & language" page in the user's preferences: For that, I am trying with the WinAPI function GetUserPreferredUILanguages(), on an up-to-date Windows 10 Pro system. However, the function always only returns the first entry (the main Windows display language), and "en-US". If English is configured as the main language, then only "en-US" is returned. E.g., if I have

GetUserPreferredUILanguages() never returns more than two languages

孤街醉人 提交于 2020-02-21 11:10:09
问题 I'm trying to retrieve the complete list of the user's preferred languages from a C++/Qt application, as configured in the "Region & language" page in the user's preferences: For that, I am trying with the WinAPI function GetUserPreferredUILanguages(), on an up-to-date Windows 10 Pro system. However, the function always only returns the first entry (the main Windows display language), and "en-US". If English is configured as the main language, then only "en-US" is returned. E.g., if I have

GetUserPreferredUILanguages() never returns more than two languages

岁酱吖の 提交于 2020-02-21 11:10:08
问题 I'm trying to retrieve the complete list of the user's preferred languages from a C++/Qt application, as configured in the "Region & language" page in the user's preferences: For that, I am trying with the WinAPI function GetUserPreferredUILanguages(), on an up-to-date Windows 10 Pro system. However, the function always only returns the first entry (the main Windows display language), and "en-US". If English is configured as the main language, then only "en-US" is returned. E.g., if I have

Easy way to translate a website

无人久伴 提交于 2020-02-21 06:05:41
问题 Question I have a fairly static website with just a few basic PHP usage. Now the customer would like to have this website translated. I do have a solution, but it's cumbersome and I was wondering how others are doing it and what is the standard (in frameworks, etc.). My Way My way (I have simplified it a bit for the sake of easier understanding): I generate a PHP array for each language from the database and store this array in a language file, like es.php for Spanish. I then translate a

Display link in Rails form error message

六月ゝ 毕业季﹏ 提交于 2020-02-18 05:07:28
问题 On our sign-up form, we validates_uniqueness_of :email When the a user is attempting to use our sign up form and they specify an existing email address, I'd like them to see an error message like this This email address is already in use. If you're having trouble logging in, you can reset your password Obviously, I'd like to use the named route for the link, but my User model does not have access to it. How can I accomplish this? Side note: We will be offering translations for our app soon

Display link in Rails form error message

前提是你 提交于 2020-02-18 05:07:12
问题 On our sign-up form, we validates_uniqueness_of :email When the a user is attempting to use our sign up form and they specify an existing email address, I'd like them to see an error message like this This email address is already in use. If you're having trouble logging in, you can reset your password Obviously, I'd like to use the named route for the link, but my User model does not have access to it. How can I accomplish this? Side note: We will be offering translations for our app soon