internationalization

HTML tags in i18next translation

断了今生、忘了曾经 提交于 2019-12-28 11:58:58
问题 I'm using i18next to power i18n for my weblog. It works great on text-only content, but when I try to translate content that includes HTML markup, it is displaying the raw markup when I translate the text. As an example, here is a snippet of the markup from a post that is not working as expected: <div class="i18n" data-i18n="content.body"> In Medellín they have many different types of <i>jugos naturales</i> (fruit juice) ... <br /> <br /> ... </div> The translation code looks like this: var

HTML tags in i18next translation

爷,独闯天下 提交于 2019-12-28 11:58:14
问题 I'm using i18next to power i18n for my weblog. It works great on text-only content, but when I try to translate content that includes HTML markup, it is displaying the raw markup when I translate the text. As an example, here is a snippet of the markup from a post that is not working as expected: <div class="i18n" data-i18n="content.body"> In Medellín they have many different types of <i>jugos naturales</i> (fruit juice) ... <br /> <br /> ... </div> The translation code looks like this: var

Django templates: Get current URL in another language

冷暖自知 提交于 2019-12-28 09:14:17
问题 I'm using i18n_patterns to create language prefixes in a Django app. My URLs look like this: /de/contact/ /fr/contact/ /it/contact/ In my base template, I'm looping over all available languages to show the language switch links. {% get_available_languages as languages %} <nav id="language_chooser"> <ul> {% for lang_code, lang_name in languages %} {% language lang_code %} <li><a href="{% url 'home' %}" alt="{{ lang_name }}" title="{{ lang_name }}">{{ lang_code }}</a></li {% endlanguage %} {%

How to add custom Accept-Languages to Chrome for pseudolocalization testing?

扶醉桌前 提交于 2019-12-28 08:08:35
问题 i am testing pseudo-localization of a web-site. i can configure Internet Explorer to have custom accept languages: Click Tools , Internet Options On the General tab click Languages In the Language Preferences dialog click Add . Enter a user-defined language of qps-ploc (i.e. the Pseudo (Base) locale) Click OK Now when Internet Explorer issues an http request, the accept languages will lead with qpc-ploc : GET https://stackoverflow.com/ HTTP/1.1 Accept: application/x-ms-application, image/jpeg

How to add custom Accept-Languages to Chrome for pseudolocalization testing?

佐手、 提交于 2019-12-28 08:08:11
问题 i am testing pseudo-localization of a web-site. i can configure Internet Explorer to have custom accept languages: Click Tools , Internet Options On the General tab click Languages In the Language Preferences dialog click Add . Enter a user-defined language of qps-ploc (i.e. the Pseudo (Base) locale) Click OK Now when Internet Explorer issues an http request, the accept languages will lead with qpc-ploc : GET https://stackoverflow.com/ HTTP/1.1 Accept: application/x-ms-application, image/jpeg

Why do Perl string operations on Unicode characters add garbage to the string?

这一生的挚爱 提交于 2019-12-28 06:49:10
问题 Perl: $string =~ s/[áàâã]/a/gi; #This line always prepends an "a" $string =~ s/[éèêë]/e/gi; $string =~ s/[úùûü]/u/gi; This regular expression should convert "été" into "ete". Instead, it is converting it to "aetae". In other words, it prepends an "a" to every matched element. Even "à" is converted to "aa". If I change the first line to this $string =~ s/(á|à|â|ã)/a/gi; it works, but... Now it prepends an e to every matched element (like "eetee"). Even though I found a suitable solution, why

Ruby method to remove accents from UTF-8 international characters

谁都会走 提交于 2019-12-28 04:54:21
问题 I am trying to create a 'normalized' copy of a string, to help reduce duplicate names in a database. The names contain many international characters (ie. accented letters), and I want to create a copy with the accents removed. I did come across the method below, but cannot get it to work. I can't seem to find what the Unicode Hacks plugin is. # Utility method that retursn an ASCIIfied, downcased, and sanitized string. # It relies on the Unicode Hacks plugin by means of String#chars. We assume

PHP: Locale aware number format

女生的网名这么多〃 提交于 2019-12-28 04:01:14
问题 I want to format the number 3253454 for my website visitors. If I use the inbuilt number_format function, I get: 3,253,454 which is great for UK and USA, however most other countries use 3.253.454 I have many international visitors. Can anyone give me a pointer to the best practice here? Ideally I wish to get the browser's locale and format the number accordingly. Is this even possible in PHP? 回答1: If you're deploying a localized website, you're going to want to make sure you setlocale(). To

Ruby 1.9: how can I properly upcase & downcase multibyte strings?

大憨熊 提交于 2019-12-27 17:07:55
问题 So matz made the decision to keep upcase and downcase limited to /[A-Z]/i in ruby 1.9.1. ActiveSupport::Multibyte has long had great i18n case jiggering in ruby 1.8.x via String#mb_chars . However, when tried under ruby 1.9.1, it doesn't seem to work. Here's a simple test script I wrote, along with the output I'm getting: $ cat test.rb # encoding: UTF-8 puts("@ #{RUBY_VERSION} " + (__ENCODING__ rescue $KCODE).to_s) sd, su = "Iñtërnâtiônàlizætiøn", "IÑTËRNÂTIÔNÀLIZÆTIØN" def ps(u, d, k); puts

JSF 2.0 set locale throughout session from browser and programmatically [duplicate]

孤者浪人 提交于 2019-12-27 12:22:24
问题 This question already has answers here : Localization in JSF, how to remember selected locale per session instead of per request/view (5 answers) Closed 4 years ago . How do I detect the locale for an application based on the initial browser request and use it throughout the browsing session untill the user specifically changes the locale and how do you force this new locale through the remaining session? 回答1: Create a session scoped managed bean like follows: @ManagedBean @SessionScoped