internationalization

boost to_upper function of string_algo doesn't take into account the locale

倾然丶 夕夏残阳落幕 提交于 2019-12-23 19:31:34
问题 I have a problem with the functions in the string_algo package. Consider this piece of code: #include <boost/algorithm/string.hpp> int main() { try{ string s = "meißen"; locale l("de_DE.UTF-8"); to_upper(s, l); cout << s << endl; catch(std::runtime_error& e){ cerr << e.what() << endl; } try{ string s = "composición"; locale l("es_CO.UTF-8"); to_upper(s, l); cout << s << endl; catch(std::runtime_error& e){ cerr << e.what() << endl; } } The expected output for this code would be: MEISSEN

before_filter set_locale except controller

风格不统一 提交于 2019-12-23 18:22:53
问题 My routes.rb MyApp::Application.routes.draw do scope '(:locale)' do #all resources here end namespace :blog do resources :posts, :only => [:index, :show] end end My application_controller.rb class ApplicationController < ActionController::Base # # before_filter :set_locale private def default_url_options(options = {}) {locale: I18n.locale} end def set_locale #code for detect locale here end # # end All the resources inside scope '(:locale)' is working fine. However I don't want use locale

locale.setlocale(LC_NUMERIC): how to make it work on Windows

梦想的初衷 提交于 2019-12-23 17:03:02
问题 I am under Win10. This is my tiny script: import locale locale.setlocale(locale.LC_NUMERIC,"rus") print locale.localeconv() fv = 2.5 print str(fv) This prints out: {'mon_decimal_point': '', 'int_frac_digits': 127, 'p_sep_by_space': 127, 'frac_digits': 127, 'thousands_sep': '\xa0', 'n_sign_posn': 127, 'decimal_point': ',', 'int_curr_symbol': '', 'n_cs_precedes': 127, 'p_sign_posn': 127, 'mon_thousands_sep': '', 'negative_sign': '', 'currency_symbol': '', 'n_sep_by_space': 127, 'mon_grouping':

Inserting a translation into a placeholder with Emblem.js

江枫思渺然 提交于 2019-12-23 16:56:07
问题 I'm trying to write a login form with ember.js/emblem.js. Everything works, unless I try I18ning the placeholders like so: Em.TextField valueBinding="view.username" placeholder="#{t 'users.attributes.username}" Em.TextField valueBinding="view.password" placeholder="#{t 'users.attributes.password'}" type="password" I get the same response if I try: = input value=view.username placeholder="#{t 'users.attributes.username}" = input value=view.password placeholder="#{t 'users.attributes.password'}

BreakIterator in Android counts character wrongly

五迷三道 提交于 2019-12-23 15:38:48
问题 I am using BreakIterator to count the number of visible character in a String. This works perfectly for English language. But in case of Hindi language it doesn't work as expected. The below String has a length of 3, but is considered as single character visually. ज्य When I used BreakIterator , I expect it to consider it as a single unit, but it considers it as 2 units. The below is my code: final String text = "ज्य"; final Locale locale = new Locale("hi","IN"); final BreakIterator breaker =

Testing helper in rspec with I18n lazy lookup

血红的双手。 提交于 2019-12-23 12:07:15
问题 Consider this example. I have a Product model which has discount_percentage . And we're maintaining multiple locales. In the view we do not want the i18n stuff mess up the view. So we make a helper to read better and probably reuse it in other views: render_product_discount (code please see below) which will render the discount status of this product. And we use i18n lazy lookup feature throughout the application. But when we want to test this helper method we get a Error: # RuntimeError: #

Why doesn't Django produce locale files from template files in another directory?

ε祈祈猫儿з 提交于 2019-12-23 10:28:17
问题 Version info: Django version 1.3 pre-alpha SVN-13858 Ubuntu GNU/Linux 10.10 I'm totally new to i18n and l10n in Django and currently I'm trying to make my Django project available in Dutch (in addition to its default language: English). I tried to apply the instructions given at http://docs.djangoproject.com/en/dev/topics/i18n/translation/ and http://www.djangobook.com/en/2.0/chapter19/ but I had no success. I don't know if this is related to my directory structure and template files being in

Why doesn't Django produce locale files from template files in another directory?

China☆狼群 提交于 2019-12-23 10:27:34
问题 Version info: Django version 1.3 pre-alpha SVN-13858 Ubuntu GNU/Linux 10.10 I'm totally new to i18n and l10n in Django and currently I'm trying to make my Django project available in Dutch (in addition to its default language: English). I tried to apply the instructions given at http://docs.djangoproject.com/en/dev/topics/i18n/translation/ and http://www.djangobook.com/en/2.0/chapter19/ but I had no success. I don't know if this is related to my directory structure and template files being in

How do I format a Currency for a Locale in Java

自古美人都是妖i 提交于 2019-12-23 10:17:24
问题 I'm surprised that I'm having real trouble finding how to do this. It seems to me it should be pretty straightforward. Perhaps I'm looking in the wrong place. Suppose I have the following code: double amount = 123.45D; //yes, I know that I should be using longs Locale uk = Locale.UK; Locale fr = Locale.FR; Currency euro = Currency.getInstance("EUR"); How do I get instances of NumberFormat that let me print out the 123.45 value correctly formatted for the Locale? ie I want the following for

How to get PHP to use internationalised dates?

早过忘川 提交于 2019-12-23 09:49:36
问题 I'm trying to get PHP dates to work cross language. The language code will be supplied according to the logged in user's language setting. I thought I could do this: setlocale(LC_ALL, 'de_DE.UTF-8'); echo strftime('%A %B %Y'); But the output is: Wednesday April 2011 Whereas I would have expected: Mittwoch April 2011 (April is the same in English and German) Is this not the correct way to use the strftime function? If not, is there an alternative method? 回答1: setlocale() returns a value, which