i18next

Cannot load external module when trying to import i18next in TypeScript

雨燕双飞 提交于 2019-12-07 20:25:37
问题 One reason why I can't import i18next is because the i18next.d.ts file does not have declare module "i18next" { export = i18next; } at the end, like jquery.d.ts and knockout.d.ts have. It only has declare var i18next: I18nextStatic; So when I tried to import in my TypeScript file using import i18next = require('i18next'); it will barf: Cannot load external module Module cannot be aliased to a non-module type I don't know why Definitely Typed project compose the d.ts file in that way. And I

Cannot load external module when trying to import i18next in TypeScript

馋奶兔 提交于 2019-12-06 06:31:00
One reason why I can't import i18next is because the i18next.d.ts file does not have declare module "i18next" { export = i18next; } at the end, like jquery.d.ts and knockout.d.ts have. It only has declare var i18next: I18nextStatic; So when I tried to import in my TypeScript file using import i18next = require('i18next'); it will barf: Cannot load external module Module cannot be aliased to a non-module type I don't know why Definitely Typed project compose the d.ts file in that way. And I don't know if declare module will be a good solution or not. Someone please help. Jamie Dixon You

Marionette.Renderer, Underscore templates and internationalization with i18next

大兔子大兔子 提交于 2019-12-06 02:07:52
问题 We are currently in the need of adding internationalization to a medium sized app using Backbone.Marionette and underscore templates. After some thorough research, two valid options are emerging : underi18n which provides direct integration with underscore, but lacks pluralization, which becomes essential for supporting more than french and english i18next which provides a powerful API but only direct integration with handlebars templates We will need on a longer term to localize in many more

Localization/Internationalization for Polymer 1.0

╄→尐↘猪︶ㄣ 提交于 2019-12-05 19:58:27
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.blogspot.gr/2014/02/getting-started-with-i18next-and-polymer.html . The thing is, I seem to get wrong

i18next Displayed key instead of value

﹥>﹥吖頭↗ 提交于 2019-12-05 16:05:09
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 You have to set useLocalStorage and useDataAttrOptions to true $.i18n.init({useLocalStorage: true ,

react-i18next not loading json translation files in React app created with create-react-app

大兔子大兔子 提交于 2019-12-04 08:20:44
I've created a React application with create-react-app I want to implement translations and I've discovered react-i18next After installing required packages I've setup my i18n.js config file: import i18n from 'i18next'; import LanguageDetector from 'i18next-browser-languagedetector'; import XHR from 'i18next-xhr-backend'; i18n .use(XHR) .use(LanguageDetector) .init({ debug: true, lng: 'en', nsSeparator: false, keySeparator: false, fallbackLng: false, backend: { loadPath: 'locales/{{lng}}/{{ns}}.json' } }); export default i18n; I'm getting this error: i18next::backendConnector: loading

How can I use translations in i18next in javascript

两盒软妹~` 提交于 2019-12-02 05:37:59
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) ? It should be alert(t(someKey)) (see http://i18next.com/ at end of page). 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. It's important to note that that t is passed to the init callback as a parameter - you can't just blindly call t(

npm install i18next-conv: Error: Cannot find module 'readable-stream'

我是研究僧i 提交于 2019-12-02 03:17:09
问题 I'm trying to install i18next-conv but, when I run sudo npm install i18next-conv -g , I get this error: Error: Cannot find module 'readable-stream' at Function._resolveFilename (module.js:337:11) at Function._load (module.js:279:25) at Module.require (module.js:359:17) at require (module.js:375:17) at Object.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/sha/index.js:3:48) at Module._compile (module.js:446:26) at Object..js (module.js:464:10) at Module.load (module.js:353:31) at

reactjs - fetch as google displays blank page only

最后都变了- 提交于 2019-11-30 21:52:34
I've just coded my first website using reactjs, but when I check how google sees my website, I receive the following result: My HTML file looks like this: <!DOCTYPE html> <html> <head> <title>MySite</title> </head> <body> <div id="root"></div> <script async type="text/javascript" src="index.browser.js"></script> </body> </html> I've deactivated all AJAX-calls for testing, and the ReactDOM.render gets executed right after its js file was loaded. The JS file itself is compiled, compressed and less than 300 KB big (including all libraries like react itself). At this point, I don't understand

reactjs - fetch as google displays blank page only

主宰稳场 提交于 2019-11-30 17:47:36
问题 I've just coded my first website using reactjs, but when I check how google sees my website, I receive the following result: My HTML file looks like this: <!DOCTYPE html> <html> <head> <title>MySite</title> </head> <body> <div id="root"></div> <script async type="text/javascript" src="index.browser.js"></script> </body> </html> I've deactivated all AJAX-calls for testing, and the ReactDOM.render gets executed right after its js file was loaded. The JS file itself is compiled, compressed and