internationalization

Is there an existing I18N translation for booleans?

北慕城南 提交于 2019-12-09 04:13:46
问题 I need to display "Yes" or "No" in various languages based on whether a expression is true or false. Currently I am doing it like this: fr.yml: fr: "yes": Oui "no": Non a helper method: def t_boolean(expression) (expression) ? t("yes") : t("no") end erb: Valid: <%= t_boolean(something.is_valid?) %> Is there some better way to do this? Does Rails already have translations for true/false like this? 回答1: After reading this, I got inspired and figured out this solution: fr.yml fr: "true": Oui

Customizing datetime format in en.yml in Rails 3

佐手、 提交于 2019-12-09 04:13:39
问题 According to documentation at http://guides.rubyonrails.org/i18n.html#adding-date-time-formats, the best way to ask for specific formats for a date is to define them in /config/locales/en.yml. I've copied and pasted this file: https://github.com/rails/rails/blob/master/activesupport/lib/active_support/locale/en.yml to my locales directory. I've made a few changes (asterisks for emphasis only): "en-US": date: formats: default: "%Y-%m-%d" **short: "short %b %d"** and time: formats: default: "%a

.po to .mo convertor in php?

青春壹個敷衍的年華 提交于 2019-12-09 03:42:29
问题 i want a PHP script which can convert .po (Portable Object) as .mo (Machine Object) file? is any script available in PHP? byte +------------------------------------------+ 0 | magic number = 0x950412de | | | 4 | file format revision = 0 | | | 8 | number of strings | == N | | 12 | offset of table with original strings | == O | | 16 | offset of table with translation strings | == T | | 20 | size of hashing table | == S | | 24 | offset of hashing table | == H | | . . . (possibly more entries

Localization Strategy

给你一囗甜甜゛ 提交于 2019-12-09 03:36:26
We're currently debating two strategies of localization: A. Have an XML file for the structure of the business objects with a Localized key to a separate CSV file for the translation. for eg. /Resources/Schema.xml in a separate CSV file: we have all key/value pairs for the translations: /Resources/Localized.txt Model_Title, Title, Title (in French), ... This way, when the structure changes, we just change XML once while the LocalizedKey's are in place. B. Have separate XML files for each language based on Culture. eg. have two files: /Resources/en-US/US-Localized.xml /Resources/fr-AU/AU

Rails / I18n: default scope

独自空忆成欢 提交于 2019-12-09 02:15:25
问题 I'm using the default I18n module for Rails to translate my strings in views. <%= t("registration.heading") %> Now, when I'm in the registration-view, all my strings start with registration . I always have to write <%= t("registration.heading.notice") %> // or <%= t(:heading, :scope => :registration) %> It would be nice to define a default scope for that file (maybe even in the controller), so a call to t automatically adds the defined scope // controller set_i18n_default_scope :registration

What is the difference between creating locale for en-US and en_US?

被刻印的时光 ゝ 提交于 2019-12-08 23:04:53
问题 I am having all my resourcebundle values in table and formatted as per requirement.i have to change the languages in the website based on User selection in drop down in top of the page. If i use language code as en_US then its working fine. if i Use en-Us as Language Code then its not working. What might be the problem. Which is correct to follow? 回答1: "en" is the language code specified by ISO 639. while US is country code specified by 3166. In Java, the Locale object recognizes the language

devanagari i18n in java

早过忘川 提交于 2019-12-08 19:08:53
问题 I am trying to use i18n in java for devanagari/hindi using sample ttf files from internet. I am able to load resource bundle entries and also load the ttf and set font but it will not render jlabel as desired. It shows blocks in place of characters. If I debug in eclipse I can hover over the unicode variable and it even renders devanagari. Below is code and resource bundle for reference. package i18n; import java.awt.Font; import java.awt.GridLayout; import java.io.InputStream; import java

boost::algorithm::to_upper/to_lower ok for utf8? boost::locale not necessary?

痴心易碎 提交于 2019-12-08 19:08:04
问题 I've read in several places that boost::algorithm::to_upper/to_lower are not ok for utf8: http://www.boost.org/doc/libs/1_51_0/libs/locale/doc/html/conversions.html How to convert std::string to lower case? Working with UTF8 But on my system, ubuntu 12.4.1 32 bits with boost 1.46, and locale en_GB.UTF-8, everything looks fine,as long as I pass the locale Eg: std::locale englishUTF8locale("en_GB.UTF-8") boost::algorithm::to_upper_copy(L"ü", englishUTF8locale) -> L"Ü" boost::algorithm::to_lower

Implementing Globalization / Multilingual feature in win32 API application

▼魔方 西西 提交于 2019-12-08 17:30:35
问题 I have developend a window application(Win32 API) in visual C++. I have to add multilingual feature in this application. Can any one Pls guide me how to get forward with this task. 回答1: the basics for a multilingual application on Windows is the use of "resources". a resource is a chunk appended at the end of your executable, which only contains data, and is formatted in a very specific way in order for Windows to be able to interpret those data. in your resources, you can find dialog boxes,

Shall REST API error messages be internationalized?

烂漫一生 提交于 2019-12-08 17:13:34
问题 When designing the errors of a REST API seems to be a good practice to follow standard HTTP codes (4XX and 5XX) and to include a body (XML/JSON) with: brief message description code My question is ... shall these messages be internationalized? I tend to think that showing a message to the client is client side responsability, and those API errors should be considered as an agreement (format, and code field) between the client app and the API but shall not be considered by default as perfectly