internationalization

Jinja2 translation of links

我的未来我决定 提交于 2019-12-04 07:47:50
From a Jinja2 template, this is the rendered line I'm after (in English): This is the <a href="roadmap.html">roadmap</a> Translated in Dutch should result in: Dit is de <a href="roadmap.html">planning</a> This Jinja2 line gets me there -almost- {{ _('This is the %(roadmap)s.', roadmap='<a href="roadmap.html">roadmap</a>'|safe) }} Unfortunately, the word 'roadmap' is not translated. What would be the Jinja2 way of accomplishing this? Splitting the link in roadmap1 and roadmap2? I hope for something more clever. These should work: {{ _('This is the') }} <a href="roadmap.html">{{ _('roadmap') }}<

Java internationalization (i18n) with proper plurals

旧时模样 提交于 2019-12-04 07:41:36
问题 I was going to use Java's standard i18n system with the ChoiceFormat class for plurals, but then realized that it doesn't handle the complex plural rules of some languages (e.g. Polish). If it only handles languages that resemble English, then it seems a little pointless. What options are there to achieve correct plural forms? What are the pros and cons of using them? 回答1: Well, you already tagged the question correctly, so I assume you know thing or two about ICU. With ICU you have two

How to set and handle language in react-router from?

独自空忆成欢 提交于 2019-12-04 07:35:56
I have been trying to resolve this all day and finally i come to you all. The task is simple, I need to set language type in the URL, so it looks something like this: domain.com/{langVar}/other/paths And be able to change it by clicking/selecting language in my apps header or any other component. Important: the language variable should always remain in the URL. I am using "react-router": "^2.7.0", "react": "^15.3.1". This is how my router config looks like: export default ( <Router history={browserHistory}> <Route path="/:lang" component={MainApp}> <IndexRoute component={Home} /> <Route

Get all available cultures from a .resx file group

好久不见. 提交于 2019-12-04 06:51:18
I need to programatically list the available cultures in a resx file group, but the ResourceManager class doesn't seem to help. I may have : Labels.resx Labels.fr-FR.resx Labels.ro-RO.resx and so on However, how can I find these three (or how many would there be) cultures at runtime? Look for satellite assemblies in your application's directory: for each subdirectory, check if its name corresponds to a culture name, and if it contains a .resources.dll file : public IEnumerable<CultureInfo> GetAvailableCultures() { var programLocation = Process.GetCurrentProcess().MainModule.FileName; var

How to enable Rails I18n translation errors in views?

爷,独闯天下 提交于 2019-12-04 06:29:49
I created new Rails 3 project. I try to use translations in my views like this: = t('.translate_test') In my browser i looks "translate_test" instead "my test translation" witch i set in en.yml . My main question - why i can't see error like "Missing translation: en ..." ? In Rails 3 they don't show you this text anymore. If you inspect the element in the html source you will see the translation missing message. You can turn fallbacks off, try to put in your environment or an initializer the following: config.i18n.fallbacks = false I've created this initializer to raise an exception - args are

Converting Greek to Uppercase in Java

时间秒杀一切 提交于 2019-12-04 06:24:47
What I'm trying to do is fairly simple: String example = "Τάχιστη αλώπηξ βαφής ψημένη γη - Mary Had A Little Lamb"; String upper = example.toUpperCase(); In Greek, only the first letter of an uppercase word should contain accented characters. // upper contains the following (incorrect) string: // ΤΆΧΙΣΤΗ ΑΛΏΠΗΞ ΒΑΦΉΣ ΨΗΜΈΝΗ ΓΗ - MARY HAD A LITTLE LAMB // correct string: // ΤΑΧΙΣΤΗ ΑΛΩΠΗΞ ΒΑΦΗΣ ΨΗΜΕΝΗ ΓΗ - MARY HAD A LITTLE LAMB (The accents are hard to see, but they're there.) According to the Java 1.7 documentation , I should be able to pass a locale to toUpperCase , like so: String upper =

bug in “django-admin.py makemessages” or xgettext call? -> “warning: unterminated string”

Deadly 提交于 2019-12-04 06:11:09
问题 django-admin.py makemessages dies with errors "warning: unterminated string" on cases where really long strings are wrapped: string = "some text \ more text\ and even more" These strings don't even need to be translated - e.g. sql query strings. The problem goes away when I concatenate the string, but the result looks ugly and it takes time to join them... Does anyone have a problem like this? Have you found a way to fix it? I have the following versions of the tools involved: xgettext-0.17,

Does there exist a publicly accessible parsable Country/Country Code list? [closed]

我的梦境 提交于 2019-12-04 05:58:53
I find that I always find it useful to have a list of all Countries and their country codes. If someone provided it in multiple formats (eg: SQL, DDL, Xml, CSV, JSON, YAML... ). I've found sites that attempt to sell a list of countries but that seems crazy to me. Is there an open source project that I'm overlooking? If there isn't does anyone else see any usefulness of starting a project that maintains a list of countries and even something that attempts a region hierarchy? There have been times where I have been wanting to retrieve the top 50 largest cities in a province located in Canada for

Tool to find duplicate keys and value in properties file

廉价感情. 提交于 2019-12-04 05:50:00
is there a tool that tells me redundant keys and values that are there in my one or many properties file. There is an Ant task, RscBundleCheck, that checks for the existence of duplicate keys in a set of resource files: http://rscbundlecheck.sourceforge.net/ This would be simple way to integrate checking for duplicate properties into your build process. /** * Purpose: Properties doesn't detect duplicate keys. So this exists. * @author shaned */ package com.naehas.tests.configs; import java.util.Properties; import org.apache.log4j.Logger; public class NaehasProperties extends Properties {

Converting special character to plain text in oracle

被刻印的时光 ゝ 提交于 2019-12-04 05:37:38
问题 we are having a database with utf8 as charset. now in one table we are having a value like 'HERBES-Herbe à poux' . now we have to convert it into 'HERBES-Herbe a poux' . i.e à-->a. We cannot have a replace function since the values are dynamic. Please help us. 回答1: What constitutes a "special character" to you? Anything outside the US7ASCII character set? You can potentially use the CONVERT function SELECT convert( <<your string>>, 'US7ASCII' ) FROM table_name Assuming that there is a mapping