internationalization

Change the iOS simulator's current locale at runtime

 ̄綄美尐妖づ 提交于 2019-12-22 03:35:17
问题 While developing a set of date calculations and language rules for converting numeric values and dates to strings, I'm writing tests that assert the outcome of the string formatting method. An imaginary assertion for it might looks like this: NSAssert([dateString isEqualToString:@"Three days, until 6:00 PM"], @"Date string should match expectation"); However, because the app is localized for several languages, and my fellow developers are also from and in different locales than I, it can

Write # in yaml (in the string)

我与影子孤独终老i 提交于 2019-12-22 01:25:17
问题 I'm new using yml files (for translations in my framework). I'm trying to add a "#" inside the translation (will be a twitter share... blabla). Is this possible, because the file translate it like a comment... 回答1: Just put the value inside single or double quotes and it won't be treated like a comment. Something like: en: twitter: share: "#hashtag" 来源: https://stackoverflow.com/questions/13711444/write-in-yaml-in-the-string

Strings in Applescript depends on the system language - are there universal names?

蹲街弑〆低调 提交于 2019-12-22 01:00:44
问题 I write some Applescripts that are gonna be deployed on machines set to different languages. I just realised that when I, for example, is waiting for an application to open a window (e.g., a Save/Open dialog) my scripts fail because on systems set to other languages these windows are not called Save or Open anymore, but rather have a translated name. How do I handle this? Do windows have "universal base name" I can look for rather than the name I Accessibility Inspector shows? And I guess

How do I make the error message for validates_inclusion_of show the list of allowed options?

风流意气都作罢 提交于 2019-12-22 01:00:37
问题 I have a validates inclusion: in my model, but I think the default error message of "is not included in the list" is entirely unuseful. How do I make it show the list of allowed options in the error message itself? (for example, "is not one of the allowed options (option 1, option 2, or option 3)" ? More concretely, what is the most elegant way to get the following tests to pass: describe Person do describe 'validation' do describe 'highest_degree' do # Note: Uses matchers from shoulda gem it

Strings in Applescript depends on the system language - are there universal names?

二次信任 提交于 2019-12-22 00:34:01
问题 I write some Applescripts that are gonna be deployed on machines set to different languages. I just realised that when I, for example, is waiting for an application to open a window (e.g., a Save/Open dialog) my scripts fail because on systems set to other languages these windows are not called Save or Open anymore, but rather have a translated name. How do I handle this? Do windows have "universal base name" I can look for rather than the name I Accessibility Inspector shows? And I guess

How to internationalize metas such as title in view.yml?

风格不统一 提交于 2019-12-22 00:24:26
问题 I'd like to internationalize the strings of my view.yml, I can't find how to do this. I have a solution that is bad, in my opinion: metas: title: <?php echo sfContext::getInstance()->getI18n()->__('TITLE'); ?> I'd like to find a way to do it without calling "sfConfig::getInstance()". Is it possible? 回答1: Never ever use sfContext for I18n in Configuration-Files! In such a case use the setTitle function in the View (not the controller) <?php $sf_response->setTitle(__('TITLE'));?> 回答2: Since

Silverlight - Paramterised resource values for Internationalisation

一曲冷凌霜 提交于 2019-12-21 23:25:12
问题 I'm running into a problem that seems to have no sensible / tractable solution that I am happy with. Silverlight and Internationalisation - a quagmire in the making. I have a set of resource files that contain translated strings. In the simple case, I can declare the language resource etc and bind the content / text of a value within the strongly typed resource. Thats fine - plenty of examples of that posted around. A less simple case is that the strings can have a parameter, so I need to

I18n C++ hello world with plurals

扶醉桌前 提交于 2019-12-21 22:59:16
问题 Complete C++ i18n gettext() “hello world” example has C++ code that works for a simple fixed string. I am now looking for an example program that works with plurals. This example code displays six lines. Only one is correct in English. It does not handle the plurals correctly. cat >helloplurals.cxx <<EOF // hellopurals.cxx #include <libintl.h> #include <locale.h> #include <iostream> #include <stdio.h> int main (){ setlocale(LC_ALL, ""); bindtextdomain("helloplurals", "."); textdomain(

I18n: What is the difference between using 't(:test_key)', 't('test_key')' and 't('.test_key')'?

半世苍凉 提交于 2019-12-21 21:38:48
问题 I am using Ruby on Rails 3.1 and I would like to know how , when and why I should use one of the following code rather than another on internationalizing my application (I18n gem): t(:test_key) t('test_key') t('.test_key') That is, what is the "subtle" difference between using t(:test_key) , t('test_key') and t('.test_key') ? What are best practices about this issue? 回答1: I think first two are equivalent and you just refer to main key in your translations, fo example t('hello_world') # t(

Finding the client's timezone and culture via web service

≯℡__Kan透↙ 提交于 2019-12-21 21:32:34
问题 I have a .NET web service. It serves AJAX requests from web users. I would simply like to know how to automatically get the user's timezone... Not current time offset, but the actual timezone - like, Central Standard Time is -5:00 right now, but Eastern Standard Time will be -5:00 once daylight savings is over. I want to differentiate these users. I would also like to know how to get their culture settings ("en-US", etc.) so I can render DateTimes and numbers from my web service to their