internationalization

I18n for model-specific Rails submit button

跟風遠走 提交于 2019-12-30 03:40:08
问题 I've found that Rails allows for generic i18n of submit buttons via the following in config/locales/en.yml : en: helpers: submit: create: "Create %{model}" submit: "Save %{model}" update: "Update %{model}" However, I'm looking to update the create value only for one specific model. I'd like the text to read as "Upload %{model}" or just "Upload". How can I make this change for just one model (e.g.: a Photo model)? 回答1: From the source code, it looks like you should be able to do this: en:

What are the best practices for internationalizing a Java Swing desktop application?

老子叫甜甜 提交于 2019-12-30 02:30:05
问题 I'm sure there are a lot of methods, but what's the recommended way to do this that has the least amount of impact to your code? The obvious is that you create properties files, but how do you swap the values in the rendering? In J2EE you always just re-render the whole page so it's easy. But in Swing apps, do you just add the code for the .getProperty() in the paintComponent(Graphics g) method? If that's the case, doesn't it seem heavy since now you'll have to override this method everywhere

Django form and i18n

笑着哭i 提交于 2019-12-30 01:08:05
问题 I have forms that I want to display in different languages : I used the label parameter to set a parameter, and used ugettext() on the labels : agreed_tos = forms.BooleanField(label=ugettext('I agree to the terms of service and to the privacy policy.')) But when I am rendering the form in my template, using {{form.as_p}} The labels are not translated. Does somebody have a solution for this problem ? 回答1: You should use ugettext_lazy(): from django.utils.translation import ugettext_lazy # ...

Django form and i18n

拟墨画扇 提交于 2019-12-30 01:07:58
问题 I have forms that I want to display in different languages : I used the label parameter to set a parameter, and used ugettext() on the labels : agreed_tos = forms.BooleanField(label=ugettext('I agree to the terms of service and to the privacy policy.')) But when I am rendering the form in my template, using {{form.as_p}} The labels are not translated. Does somebody have a solution for this problem ? 回答1: You should use ugettext_lazy(): from django.utils.translation import ugettext_lazy # ...

file.encoding has no effect, LC_ALL environment variable does it

大憨熊 提交于 2019-12-29 08:39:05
问题 In the following Java program running in Linux using OpenJDK 1.6.0_22 I simply list the contents of the directory taken in as parameter at the command line. The directory contains the files which have file names in UTF-8 (e.g. Hindi, Mandarin, German etc.). import java.io.*; class ListDir { public static void main(String[] args) throws Exception { //System.setProperty("file.encoding", "en_US.UTF-8"); System.out.println(System.getProperty("file.encoding")); File f = new File(args[0]); for

How to use ResourceBundle

早过忘川 提交于 2019-12-29 07:35:10
问题 I'm trying to grasp internalization of java applications as shown here. I can't though. I have created a class that extends ListResourceBundle like stated and tried to retrieve the keys. I keep getting an exception though. If you check out the tutorial, it says to use .class files. This can't be right, can it? [PROJECT TREE] [Source code] Here are the two classes I'm using, just one of the MainWindow_xx_XX.java files since they're basically the same. First the ListResourceBundle: public class

django blocktrans and i18n in templates

烈酒焚心 提交于 2019-12-29 06:13:25
问题 I have an i18n problem in django: This works fine : {% trans cat.name %} cat.name will be translated But this doesn't work: {% blocktrans with cat.name|slugify as cat_slug %}{{ cat_slug }}{% endblocktrans %} cat.name is not translated If I change the filter : {% blocktrans with cat.name|capfirst as cat_slug %}{{ cat_slug }}{% endblocktrans %} I can see that the filter is working, but there is no translation... 回答1: I'm only just getting started with Django internationalization, but I think

Locale Currency Symbol

对着背影说爱祢 提交于 2019-12-29 04:20:07
问题 I having some problems getting the default currency symbol of the system. I am getting the currency symbol this way: Currency currency = Currency.getInstance(Locale.getDefault()); Log.v("TAG",currency.getSymbol()); When the system language is in English (United States) the right symbol shows up ( $ ). But when i choose the language Portuguese (Portugal) it returns this symbol ¤ . What can be causing this? 回答1: This seems to be a known issue (http://code.google.com/p/android/issues/detail?id

HTML meta tag for content language

假如想象 提交于 2019-12-29 02:48:22
问题 What is the difference between the following two HTML meta tags, for specifying spanish web page content: <meta name="language" content="Spanish"> and <meta http-equiv="content-language" content="es"> 回答1: <meta name="language" content="Spanish"> This isn't defined in any specification (including the HTML5 draft) <meta http-equiv="content-language" content="es"> This is a poor man's version of a real HTTP header and should really be expressed in the headers. For example: Content-language: es

Is it possible to configure unified format of date format for whole struts webapp?

别等时光非礼了梦想. 提交于 2019-12-29 02:01:05
问题 In any case id get exception Could not parse date . There is unified company standard of date format - 'dd/MM/yyyy' There are computers with different system locales. I am using jQueryUI for datepicker ( it is standard for widgets and already settled css styles to match application theme). At the beginning, i didn't found better solution then manually convert date string to date object using SimpleDateFormat object. Now i have converter class but still need to configure every Action that has