internationalization

Overriding default i18n messages for play 2.0

梦想与她 提交于 2019-12-18 07:04:54
问题 We use @Constraint.Required to validate the fields of our forms, and this generates a ValidationError - which is all well and nice. This error has a standard error message (error.required) which is associated with the following string: "This field is required". However, we want to have control over this string and (possibly) override it - how can we do this? We have a message file in our conf/-folder which has the following line: error.required = dummytext But the error message still reads

How can I check if a resource bundle key does not exist using JSTL tags?

断了今生、忘了曾经 提交于 2019-12-18 05:50:38
问题 I have a resource file that will have some optional keys. If the optional resource key is not present, I set a default instead. It appears that there is no easy way to determine if a key exists in the resource bundle. So this is what I'm doing to get around it. <fmt:message var="title" key="login.reg.signup.${signupForm.regfrom}.title" /> <c:if test='${fn:startsWith(title, "??")}'> <fmt:message var="title" key="login.reg.signup.default.title" /> </c:if> Is there a better way? 回答1: You could

Nginx configuration for angular i18n application

让人想犯罪 __ 提交于 2019-12-18 05:45:10
问题 I built an angular-5 application using i18n that supports both french and english. I then deployed a separate version of the app for each supported language - dist |___ en/ | |__ index.html |___ fr/ |__ index.html I also added the following nginx configuration to serve the application in both languages; server { root /var/www/dist; index index.html index.htm; server_name host.local; location ^/(fr|en)/(.*)$ { try_files $2 $2/ /$1/index.html; } } What I wanted to do is to serve both

Regex to parse international floating-point numbers

≡放荡痞女 提交于 2019-12-18 04:56:05
问题 I need a regex to get numeric values that can be 111.111,11 111,111.11 111,111 And separate the integer and decimal portions so I can store in a DB with the correct syntax I tried ([0-9]{1,3}[,.]?)+([,.][0-9]{2})? With no success since it doesn't detect the second part :( The result should look like: 111.111,11 -> $1 = 111111; $2 = 11 回答1: First Answer: This matches #,###,##0.00 : ^[+-]?[0-9]{1,3}(?:\,?[0-9]{3})*(?:\.[0-9]{2})?$ And this matches #.###.##0,00 : ^[+-]?[0-9]{1,3}(?:\.?[0-9]{3})*

Keeping i18n resources synced

时光毁灭记忆、已成空白 提交于 2019-12-18 04:55:14
问题 I am looking for an editor/comparator for i18n property files that would help me keep different language files in sync. Basically, something that would compare a bunch a of property files and show which keys are not present in a particular language. a property would look something like component.titlepage.title = hello world A simple diff is not possible since the right-hand-side will be different from a language to another. Our current infrastructure: Java application Built using maven2

How to load a content script on all Google (international) pages?

北战南征 提交于 2019-12-18 04:47:07
问题 For a Google-Chrome extension, I would like to load a content script on all Google pages. What is the best way to do this? I tried this, in the manifest.json , but it does not work: "matches": ["http://www.google.*/*", "https://www.google.*/*"], This "works" but it is a bit long to write and I do not think it is the best practice: "matches": ["http://www.google.com/*", "https://www.google.com/*", "http://www.google.fr/*", "https://www.google.fr/*", "http://www.google.de/*", "https://www

Rails I18n of CSS file

大城市里の小女人 提交于 2019-12-18 03:42:12
问题 I am trying to internationalize my site, and one thing is to use different font-size for different languages. Also some text-images need to be replaced as well. I think the only way to do this is to have additional locale-specific CSS files in the public folder and load them based on locale in my view. This avoids asset pipeline from compiling those specific CSS files. But I am wonderiing if there a better way to do this? 回答1: Your best bet in organization is to have different style sheets

Rails I18n of CSS file

最后都变了- 提交于 2019-12-18 03:41:40
问题 I am trying to internationalize my site, and one thing is to use different font-size for different languages. Also some text-images need to be replaced as well. I think the only way to do this is to have additional locale-specific CSS files in the public folder and load them based on locale in my view. This avoids asset pipeline from compiling those specific CSS files. But I am wonderiing if there a better way to do this? 回答1: Your best bet in organization is to have different style sheets

How to unit or integration test use of injected messageSource for i18n in Grails 2.0 service

北城余情 提交于 2019-12-18 03:17:10
问题 I make use of a message bundle in one of my services in a Grails 2.0 project for internationalized text. The use case is an email subject that is sent via the mail plugin in an asynchronous way, so it really doesn't make sense to have this in a controller or TagLib (given the usual argument of not accessing your text or views in a service). This code works fine in my running Grails app, but I'm not sure how to test it. I tried a PluginAwareResourceBundleMessageSource in my defineBeans as that

How to debug gettext not working in PHP?

大憨熊 提交于 2019-12-18 03:14:05
问题 i am trying to use the php gettext extension in php 5.5 (on win2008 server, using IIS7). I am doing this: <?php $locale = "es"; if (isSet($_GET["locale"])) $locale = $_GET["locale"]; putenv("LC_ALL=$locale"); setlocale(LC_ALL, $locale); bindtextdomain("messages", "./locale"); textdomain("messages"); echo gettext("Hello world"); ?> With this folder structure in place: locale/es/LC_MESSAGES/messages.mo But it always just returns Hello world and not the correct translation which for now (based