internationalization

Rails 3 change default english numbers to arabic numbers

浪子不回头ぞ 提交于 2020-01-01 19:48:06
问题 I want to change the default numbers from english to arabic when the user switches to the arabic interface. 13 => ١٣ 89 => ٨٩ What is the best way to tackle this problem? 回答1: I add in helper module ARABIC_NUMBERS = %w(٠ ١ ٢ ٣ ٤ ٥ ٦ ٧ ٨ ٩) def ta numbers numbers = numbers.to_s if numbers.is_a? Integer results = numbers.chars.map { |char| ARABIC_NUMBERS[char.to_i] }.join end 回答2: Check this code : https://github.com/gdotdesign/rails-arabic-convert/blob/master/app/helpers/convert_helper.rb. It

Access translated i18n messages from Scala templates (Play! Internationalization)

限于喜欢 提交于 2020-01-01 19:05:20
问题 In my Play! 2.0 application I would like to define the following languages: # The application languages # ~~~~~ application.langs=en-GB,de-DE,nl-NL I also have created 3 files that ends with the corresponding language codes: Messages.en-GB Messages.de-DE Messages.nl-NL When I start the application without any request for a translated key I get the following error message: conf/application.conf: 12: Key 'de-DE' may not be followed by token: ',' (if you intended ',' to be part of the value for

Access translated i18n messages from Scala templates (Play! Internationalization)

拈花ヽ惹草 提交于 2020-01-01 19:05:19
问题 In my Play! 2.0 application I would like to define the following languages: # The application languages # ~~~~~ application.langs=en-GB,de-DE,nl-NL I also have created 3 files that ends with the corresponding language codes: Messages.en-GB Messages.de-DE Messages.nl-NL When I start the application without any request for a translated key I get the following error message: conf/application.conf: 12: Key 'de-DE' may not be followed by token: ',' (if you intended ',' to be part of the value for

How do you rescue I18n::MissingTranslationData?

坚强是说给别人听的谎言 提交于 2020-01-01 17:00:33
问题 I want to be able to rescue I18n::MissingTranslationData like so: begin value = I18n.t('some.key.that.does.not.exist') puts value return value if value rescue I18n::MissingTranslationData puts "Kaboom!" end I tried the above, but it doesn't seem to go into the rescue block. I just see, on my console (because of puts ): translation missing: some.key.that.does.not.exist . I never see Kaboom! . How do I get this to work? 回答1: IMO, it's pretty strange but in the current version of i18n (0.5.0)

Dynamic locale switching in a JSF app?

六月ゝ 毕业季﹏ 提交于 2020-01-01 11:48:11
问题 I have an application where the user can dynamically switch between locales from the welcome page of my application. I see that the earlier developer (inherited the code without much documentation) has overridden the following three methods from ViewHandler and tells me that this is required for dynamic switching of the Locale...any help is highly appreciated Also, do let me know if there is a better way of handling this public Locale calculateLocale(FacesContext facescontext) { Locale

Dynamic locale switching in a JSF app?

时间秒杀一切 提交于 2020-01-01 11:48:04
问题 I have an application where the user can dynamically switch between locales from the welcome page of my application. I see that the earlier developer (inherited the code without much documentation) has overridden the following three methods from ViewHandler and tells me that this is required for dynamic switching of the Locale...any help is highly appreciated Also, do let me know if there is a better way of handling this public Locale calculateLocale(FacesContext facescontext) { Locale

Using Closure Library on Phonegap(Android) application

情到浓时终转凉″ 提交于 2020-01-01 09:27:38
问题 Hi has any one used google's Closure Library https://developers.google.com/closure/ in building Phonegap applications on Android. I have read that Closure has good support for internationalization of applications. So if anyone could provide material they referred or sample snippets to get an idea of how to implement it. 回答1: There is no difference as to how you use PhoneGap. Framing a web view inside a native app background, doesn't change. The Closure Library, unlike any other library, will

{% trans “string” %} not working on templates but {% trans variable %} does

岁酱吖の 提交于 2020-01-01 09:14:11
问题 I'm quite new to Django and I'm working on a project with i18n, the thing is that I have translated some variables using .manage.py makemessages / compilemessages on my template file, but when I use {% trans "my string" %} I got the same "my string" for all the languages. What am I doing wrong? Here's the code for the views.py and the idioma.html views.py: #some code here... def idioma(request): output = _("Mensaje en espanol") return render_to_response( 'idioma/idioma.html', { 'idioma' :

How to use single quotes in i18n in Playframework2?

我怕爱的太早我们不能终老 提交于 2020-01-01 09:07:10
问题 While working on a French app (french language is full of single quotes), I needed to use i18n with single quotes and many other accentuated chars. So here is an extract of my messages.fr-FR file : some.key=C'est la vie! And here is the output : Cest la vie! How can I use strings containing single quotes in my messages? Already tried those : some.key=C\'est la vie! --> C\est la vie! some.key="C'est la vie!" --> "Cest la vie!" EDIT : Thanks to the link KDavid gave I was able to find the

In HTML and CSS, how do I make japanese text break lines correctly?

[亡魂溺海] 提交于 2020-01-01 08:07:33
问题 I'm writting a simple paragraph in both English and Japanese, using only HTML and CSS. The English text breaks lines normally (when a word doesn't fit on a line anymore, it's pushed to the next one). With Japanese though, not a whole word is pushed to the next line, but part of it only. I've tried setting word-wrap to break-word and normal, but nothing changes (with the Japanese text). How to I make whole words in Japanese jump to the next line like it happens in English? 回答1: English