internationalization

Symfony translation with placeholder doesn't work

倖福魔咒の 提交于 2021-02-05 09:13:26
问题 I'm trying to translate my app with Symfony translate (5.1.*). I use Symfony 5.1. Basic translation work fine but I have problem with variable in twig. When I do {% trans with {'%name%': 'World'} from 'app' %}Hello %name%{% endtrans %} It works fine and the result is Hello World as expected. But if I do php bin/console translation:update --force en php bin/console cache:clear to generate the translation file, the result is Hello %name% . If in the translation file, I delete this reference:

automatic transalation of django.po files using google translator

为君一笑 提交于 2021-02-05 07:16:36
问题 I am having a very big django.po file with all msgids populated. Now i need to substitute msgstr with the equivalent translated string.Every time i need to copy the string to google translator get the translated string and paste it to the file. Is there any too that can get the target language and populate all the msgstr's with the translated string? 回答1: You can try django-rosetta app. It has automatic ajax-based bing translation as an option. https://github.com/mbi/django-rosetta 回答2: It's

How to customize spring security messages in spring boot 2.3.1

若如初见. 提交于 2021-01-29 21:30:53
问题 I've defined this below bean as message source: @Bean("messageSource") public MessageSource messageSource() { ResourceBundleMessageSource messageSource = new ResourceBundleMessageSource(); messageSource.setBasenames("i18n/messages"); messageSource.setDefaultEncoding("UTF-8"); return messageSource; } and this is content of messages.properties file under src/main/resources/i18n/ folder: ExceptionTranslationFilter.insufficientAuthentication=A Custom message AbstractAccessDecisionManager

Wagtail modeltranslation language switcher doesn't work on /search page

落爺英雄遲暮 提交于 2021-01-29 18:22:59
问题 I have added search url to i18n_patterns , but the language switcher doesn't work on that page. urls.py: urlpatterns += i18n_patterns( path("search/", search_views.search, name="search"), path("", include(wagtail_urls)), ) language switcher: {% get_available_languages_wmt as languages %} <div class="nav-item dropdown float-right"> <p class="nav-link dropdown-toggle m-auto" data-toggle="dropdown" role="button" aria-expanded="false"> {{ request.LANGUAGE_CODE|upper }}</p> <div class="dropdown

Shiny.i18n not translate the modal dialoge rendered within module

北城以北 提交于 2021-01-29 08:12:12
问题 I want to translate parts of my UI in a modularized shiny app. As I summarized my simplified code, in the first module I have no problem with i18n as it is enters to the module 1 with argument i18n and translation works well in registerUI(based on recommendation here). But my problem is with the UI of module 2 (M2UI) which this function itself called within the server of module 1 (register) to return a modal dialogue. But i18n not detected and translation not works on displayed new modal. Any

Method to parse decimals with various decimal/radix separators

醉酒当歌 提交于 2021-01-29 06:52:37
问题 I do a lot of file parsing, which involves parsing data types like decimal. To help make the code more readable, I've been using the following method: public static decimal? ToDecimal(this string data) { decimal result; if (decimal.TryParse(data, NumberStyles.Integer | NumberStyles.AllowDecimalPoint, CultureInfo.InvariantCulture, out result)) return result; return null; } This works fine for decimals which are represented with a full-stop/period as the decimal separator. However, I'd like

TestCafe & chrome:headless : how to force the browser language (locale)

谁说我不能喝 提交于 2021-01-29 03:13:32
问题 I have write a few browser test who run with TestCafe, chrome:headless. The test are launched by commandline, from a server that I don't want to change the default language. My website is multi-language. I want to be change the language of the test, without having to impact the language of the server/computer each time. How can I do that? I launch the tests with this command line: npx testcafe chrome:headless src/scenarios/**/*.test.ts 回答1: It all depends on your "multi-language"

Sphinx documentation: translation (i18n) of conf.py variables

二次信任 提交于 2021-01-29 02:50:40
问题 In a sphinx documentation project, how to add translations to the variables defined in conf.py ? Case in point: The project Variable is "<Brand Name> Setup and Configuration Manual" , where I would like to have the latter part translated. Using the standard i18n facilities, those values are missing from the .pot files. I also could not find out how to get at the commandline-specified language within conf.py (to translate via hardcoded dictionary). 回答1: As mentioned in the comments above, this

How to do i18n with MongoDB?

六眼飞鱼酱① 提交于 2021-01-28 07:26:12
问题 I'm writing a service with sprint boot. And for the persistence layer I'm using MongoDB. There's some i18n cases in my service but I'm not going to use Mongoid. Should I design the tables like other db? Or is there any best practice of doing i18n with MongoDB? Thank you! 回答1: You can put actual values in an array inside of your document. Something like that: { "_id" : "some id", "defaultValue" : { "_id" : "ENG", "v" : "English Value" }, "values" : [ { "_id" : "ENG", "v" : "English Value" }, {

How do I explicitly specify language of email I want to send?

倾然丶 夕夏残阳落幕 提交于 2021-01-27 13:17:23
问题 I have a custom user model that have a preferred_language field. I want all the emails (activation and password reset) to be sent translated to the language that user specified in profile. class CustomUser(AbstractBaseUser, PermissionsMixin): ... LANGUAGE_CHOICES = ( (1, "English"), (2, "Русский") ) preferred_language = models.PositiveSmallIntegerField(choices=LANGUAGE_CHOICES, default=2, verbose_name=_("Preferred language")) I thought about setting custom email class but didn't saw in navive