i18next

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

Intermittent unit-test failure associated with i18next

▼魔方 西西 提交于 2019-12-24 09:06:01
问题 I am trying to unit test my aurelia custom element, which looks like below. // BaseText.ts import { bindable } from "aurelia-framework"; import { BaseI18N } from "aurelia-i18n"; export class BaseText extends BaseI18N { @bindable public value: string; @bindable public i18nKey: string; } // NormalText.ts export class NormalTextCustomElement extends BaseText {} // NormalText.html <template> <span t.bind="i18nKey">${value}</span> </template> Now, I want to test if I change the value of i18nKey ,

using multiple translation files in aurelia i18N

蹲街弑〆低调 提交于 2019-12-23 09:56:48
问题 I have a working app using aurelia-i18n. I would like to split translation.json file into multiple files like nav.json, message.json, etc but I am not sure how to do it. This is how it looks right now. locale |-en |- translation.json But I want to change it to this way. locale |-en |- nav.json |- message.json Is it possible to do it? If so, how do I configure it and access values in each file? 回答1: You can have multiple resource files and these are called namespaces in the i18next library (by

Jquery mobile button and i18next translations

爱⌒轻易说出口 提交于 2019-12-23 02:52:19
问题 I have been trying to solve i18next button translation problem for a while now. The button rendering breaks if I move from page1 to page2 then to page1: is there anyway to stop the button on page1 from breaking after moving from page1 to page 2 then page1 Below is the markup used : <!DOCTYPE html> <html> <head> <title>Mbank</title> <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no"> <link rel="stylesheet" href="http://code.jquery.com/mobile/1.3.2/jquery

Localization/Internationalization for Polymer 1.0

非 Y 不嫁゛ 提交于 2019-12-22 09:48:39
问题 I'm looking into solutions for polymer 1.0 and yet I find it hard to understand how this works. Found this https://github.com/Polymer/i18next-element which is unfortunately not even ready yet. Meanwhile I cannot figure out how to use i18next.I'm trying to combine all the info i can find, followed https://github.com/tabacha/javascript-i18n-example/blob/master/i18next/examle.html with any combinations from http://i18next.com/pages/sample.html and made sure to take a look at http://japhr

i18next Displayed key instead of value

感情迁移 提交于 2019-12-22 07:59:12
问题 I have translation.json file in /locales/en/ { "app": { "name": "Example App" } } In html , I have: <a href="/" data-i18n="app.name"> In js : $(document).ready(function() { var language_complete = navigator.language.split("-"); var language = (language_complete[0]); console.log('language', language); $.i18n.init({ lng: language, fallbackLng: false, debug: false }, function() { $('a').i18n(); }); }); It displayed app.name instead of Example App . What i missed in my code? Thanks 回答1: You have

i18next Displayed key instead of value

泪湿孤枕 提交于 2019-12-22 07:59:11
问题 I have translation.json file in /locales/en/ { "app": { "name": "Example App" } } In html , I have: <a href="/" data-i18n="app.name"> In js : $(document).ready(function() { var language_complete = navigator.language.split("-"); var language = (language_complete[0]); console.log('language', language); $.i18n.init({ lng: language, fallbackLng: false, debug: false }, function() { $('a').i18n(); }); }); It displayed app.name instead of Example App . What i missed in my code? Thanks 回答1: You have

Translate custom attributes with i18next (placeholder, value)

此生再无相见时 提交于 2019-12-21 03:37:30
问题 I am investigating what is possible with i18next localization library. Right now I have the following code (full Fiddle is here): HTML <div data-i18n="title"></div> <input placeholder="Hello" value="name"> <div class="holder"></div> <button class="lang" data-lang="en">Eng</button> <button class="lang" data-lang="ch">Chi</button> JS $(document).ready(function () { i18n.init({ "lng": 'en', "resStore": resources, "fallbackLng" : 'en' }, function (t) { $(document).i18n(); }); $('.lang').click

How can I use translations in i18next in javascript

爱⌒轻易说出口 提交于 2019-12-20 05:11:09
问题 I know that I can use i18next to translate languages in html. For example: <div data-i18n="someKey"></div> But is there a way to somehow use it in JS. For example if I want to do something like alert(someKey) ? 回答1: It should be alert(t(someKey)) (see http://i18next.com/ at end of page). 回答2: Having read the homepage of the project... i18n.init(function(t) { // translate nav $(".nav").i18n(); // programatical access var appName = t("app.name"); }); That last part is what you're looking for.