Comments (8)
In that case I made a buzz about nothing 😪. @karellm already added comment-line switch --ignoreVariables with version 0.10. Then it provides a warning instead of an error.
from i18next-parser.
I see that is introduced in PR #40 by @laszlopandy .
We use a mix of i18n.t("mykey")
and i18n.t(myvar)
i18n.t support both, using the variable is typically for translating dynamic texts. Which is very common in general programs.
We use the scanner only to extract the string version and are completely fine with the fact that the scanner ignores the one with the variable. I can imagine that you want to have a commandline argument to enable warning about it, but don't allowing this kind of use can not be the intention I suppose.
from i18next-parser.
Can you explain to me how you translate dynamic texts? I mean, how will the translated string be available for the I18n.t()
to return if the scanner cannot identify that this string is one to be translated?
from i18next-parser.
Typically the dynamic strings aren't part of the frontend, but the backend.
In our case the dynamic returned strings are in the form of a i18next key.
We provide a separate namespace file for those items (no conflict with the namespaces generated by the scanner ). Those namespace files can be either generated from master data or manually put together.
The separate namespace files are merged and upload to https://localise.biz/, after translation we download a file per language.
from i18next-parser.
If you anyway have the strings in a different namespace, why don't you use a different function to get the translation for them? I18n.t
for literals and I18n.v
for variables for example. Then the scanner would still give you a warning if you accidentally did this:
var msg = "Really long translatable string which we put into a variable so the next line doesn't wrap";
initializeWidgets([Buttons.OK, Buttons.CANCEL], I18n.t(msg), callback);
from i18next-parser.
Your suggestion make sense. Only now you force existing code to be changed, to support the detection.
The scanner behaves different after the patch then before, rather I would prefer that in such cases that new behavior can be enable or disabled by command-line.
from i18next-parser.
I'm ok with having a command line switch as well. That is a reasonable solution.
from i18next-parser.
@bitkeeper You shoudn't use https://localise.biz/ but our own service http://locize.com -> this way you support the future of i18next ;)
from i18next-parser.
Related Issues (20)
- Support namespaces per project in monorepo HOT 2
- Question(/maybe regression): should warnings be emitted for non-literal children when i18nKey (and defaults) are specified? HOT 4
- Support i18next major version 23
- Error from JSX spread attributes such as `<a {...props}>` HOT 1
- Support custom namespaced functions and components HOT 1
- Changes in order should cause --fail-on-update to fail HOT 4
- Error while following the documentation HOT 1
- Since 8.9.0, parsing is ignoring files outside the configuration file folder. HOT 8
- key is a variable, can not be parsed? HOT 1
- I don't get any output HOT 3
- New high severity vulnerability from `inflight`, coming from `[email protected]`
- Regression with version 8.0.11 HOT 4
- Incorrect extraction for multiple `useTranslation` on the same page
- @babel/runtime needed to be added as a dependency HOT 3
- Keys not being extracted when comment is inside React components HOT 1
- Can't parse namespace from getFixedT usage
- Can't extract translations from siblings folders
- CLI Exceeding call stack HOT 6
- s.codePointAt is not a function
- Extract plurals from code
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 i18next-parser.