internationalization

How to format date with a IntlDateFormatter using MEDIUM or FULL datetype, but without a year?

对着背影说爱祢 提交于 2020-01-13 05:15:28
问题 First of all: I know that I can manually create a bunch of config files with corresponding patterns for every locale; actually I try to find a workaround with using only IntlDateFormatter. I'll try to explain with examples. <?php $tz = new DateTimeZone('Europe/Moscow'); $now = time(); foreach (['en_US', 'ja_JA', 'ru_RU'] as $locale) { printf("%s:\n", $locale); foreach ([IntlDateFormatter::MEDIUM, IntlDateFormatter::LONG] as $datetype) { $formatter = new IntlDateFormatter($locale, $datetype,

Localisation/I18n of database data in LINQ to SQL

心不动则不痛 提交于 2020-01-12 11:04:11
问题 I have status tables in my database, and "localised" tables that contain language-specific versions of those statuses. The point of the main status table is to define the status ID values, and other meta-data about the status. The "localised" table is to display the text representation in a UI, according to the users' preferred language. Here is an example schema: create table [Language] ( ID smallint primary key, ISOName varchar(12) ) create table EmployeeStatus ( ID smallint primary key,

How to convert strings in any language and character set to valid filenames in Java?

痴心易碎 提交于 2020-01-12 07:54:47
问题 I need to generate file names from user inputted names. These names could be in any language. For example: "John Smith" "高岡和子" "محمد سعيد بن عبد العزيز الفلسطيني" These are use inputted values, so I have no guarantee that the names don't contain characters that are invalid to be in file names. Users will be downloading these files from their browser, so I need to ensure the file names are valid on all operating systems in all configurations. I am currently doing this for English speaking

error Could not find i18n-0.7.0 in any of the sources

前提是你 提交于 2020-01-12 07:06:20
问题 This Saturday (27th, December), I upgraded my project Rails version from version 4.1.5 to version 4.2.0. And I also upgraded the Ruby version from 2.1.2 to 2.1.5. Today, I was trying to run a Controller generator: bin/rails g controller Clients index and I realized that the command is not working. I am getting this error: Could not find i18n-0.7.0 in any of the sources I tried other commands like: bin/rake db:migrate , bin/rake and the same problem. But I can run the server using: bin/rails s

How to maintain different country versions of same language in Django?

巧了我就是萌 提交于 2020-01-12 06:56:29
问题 I would like to have a few different versions of the same language in Django, customized for different countries (e.g. locale/en , locale/en_CA , locale/en_US , etc.). If there is no language for specific country I would expect to use the default language version ( locale/en )). Then in the settings file for each site I specify LANGUAGE_CODE and LANGUAGES . For some reason, even if I specify the following settings, the locale/en_US translations are still used: LANGUAGE_CODE = 'en' LANGUAGES =

Rails: How to raise I18n translation is missing exceptions in the testing environment

我怕爱的太早我们不能终老 提交于 2020-01-12 06:31:36
问题 I want Rails to raise an exception when an I18n translation is missing in the testing environment (instead of rendering text 'translation missing'). Is there a simple way to achieve this? 回答1: To raise exceptions, you can define a class to handle localization errors. class TestExceptionLocalizationHandler def call(exception, locale, key, options) raise exception.to_exception end end Then you attach it to the desired test cases with I18n.exception_handler = TestExceptionLocalizationHandler.new

Rails: How to raise I18n translation is missing exceptions in the testing environment

烂漫一生 提交于 2020-01-12 06:31:25
问题 I want Rails to raise an exception when an I18n translation is missing in the testing environment (instead of rendering text 'translation missing'). Is there a simple way to achieve this? 回答1: To raise exceptions, you can define a class to handle localization errors. class TestExceptionLocalizationHandler def call(exception, locale, key, options) raise exception.to_exception end end Then you attach it to the desired test cases with I18n.exception_handler = TestExceptionLocalizationHandler.new

Localization of singular/plural words - what are the different language rules for grammatical numbers?

不羁的心 提交于 2020-01-12 03:14:27
问题 I have been developing a .NET string formatting library to assist with localization of an application. It's called SmartFormat and is open-source on GitHub. One of the issues it tries to address is Grammatical Numbers. This is also known as "singular and plural forms" or "conditional formatting", and here's a snippet of what it looks like in English: var message = "There {0:is|are} {0} {0:item|items} remaining"; // You can use the Smart.Format method just like using String.Format: var output

i18n Validations

我只是一个虾纸丫 提交于 2020-01-12 01:39:06
问题 Think Global, Act Local That's what they tell you, however during all my time as I developer I've always seen big companies like Google, Microsoft, Oracle and so do validations in a localized manner: they know which country I'm from so they will try to validate my phone number, postal code and other details such as bank account numbers with the proper validation methods for my country. Yesterday I signed up for Google checkout and they even showed me some examples of postal code formats in my

i18n Validations

和自甴很熟 提交于 2020-01-12 01:38:11
问题 Think Global, Act Local That's what they tell you, however during all my time as I developer I've always seen big companies like Google, Microsoft, Oracle and so do validations in a localized manner: they know which country I'm from so they will try to validate my phone number, postal code and other details such as bank account numbers with the proper validation methods for my country. Yesterday I signed up for Google checkout and they even showed me some examples of postal code formats in my