Comments (4)
Excellent, thanks for the jsFiddles, :)
from jquery-i18next.
are you sure...i think the behaviour is consistent - if there is no text found it will show the key instead -> to show devs, translators, who ever -> you forgot something: while an empty string just does not attracts attention for a mistake.
there are tons of options reading the docs:
- set a fallbackLng (so if no translation is found the sourcelanguage / fallback is shown
- override parseMissingKeyHandler: https://www.i18next.com/configuration-options.html#missing-keys
from jquery-i18next.
Yes I'm sure. In my test I had fallback language, but if your current and fallback language are the same then obviously that has no effect.
Plus it is not consistent, see my 2nd example, I'll repeat it here, if you have <h2 data-i18l="namespace.page.title"></h2>
and both the current and fallback language don't have that defined then you get <h2 data-i18l="namespace.page.title"></h2>
in your page, you do not get <h2 data-i18l="namespace.page.title">namespace.page.title</h2>
as you suggest. The only time it behaves like that (which is why I raised this bug) is when you are trying to set the value of an attribute with it.
If the plugin is suppose to work as you say then the bug is the other way around.
I guess I should admit that in the test scenario that I'm investigating using this for we are not using this for translation per say, but as a way for customers to change text on a page without us having to add special fields for them. We simply add in the markup for the page and if they want to override the default then so be it we just add a resource JSON file for that namespace for their "language", but if they don't or there is no default you don't get pointless key text.
from jquery-i18next.
ok...sorry...now found the cause. Hard to remember special cases for all the framework integrations of i18next ;)
on h2 it does show empty string as it takes by default the current initial value of the h2 as defaultValue for translations -> so it shows '' instead of key (while showing key would be default in pure i18next).
you can set 'parseDefaultValueFromContent: false' https://github.com/i18next/jquery-i18next#initialize-the-plugin
sample -> https://jsfiddle.net/yueLnwqz/
But anyway you want the '' anyway -> see https://jsfiddle.net/apnd4dnx/ uses the parseMissingKeyHandler
from jquery-i18next.
Related Issues (20)
- i18next.amd.withJQuery missing in 18next 3.x.x HOT 1
- Load i18next on framework7 ajax loaded pages HOT 8
- Unable to use JQuery 3.1.1 together with jQuery-18next. HOT 2
- jqueryI18next.init is not a function(…) HOT 4
- parser for parseDefaultValueFromContent HOT 4
- Uncaught TypeError: Cannot set property 't' of undefined HOT 8
- Upgrading from i18next.amd.withJQuery - TypeError in init HOT 4
- I can't load json files HOT 1
- How can Key Fallback option be used for translations HOT 3
- localize not defined when .use(i18nextBrowserLanguageDetector) is called HOT 5
- Spaces in data-i18n value for multiple parameters HOT 2
- i18next with razor engine HOT 13
- data-i18n not taken into consideration? HOT 2
- Not working for nested boostrap navs HOT 3
- complex replacement i18n vs i18next HOT 2
- How can I use HTML tags? HOT 2
- i18nextHttpBackend looking 'locales' folder under main directory of the server rather than working directory HOT 4
- Replace HTML tags tokens from translation HOT 9
- $.t is not a function with slow networks HOT 7
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jquery-i18next.