Comments (18)
on my "secret" ToDo List
from i18n-node.
+1
from i18n-node.
maybe like
__('Hello :firstname :lastname', {'firstname': 'Max', 'lastname': 'Mustermann'});
just to get a feeling of prefered syntax
from i18n-node.
:firstname
looks better but it might introduce problems when there is no space afterwards?
Update: See my comment below #39 (comment)
from i18n-node.
what about ${firstname} so we have a defined start and end.
from i18n-node.
I'd prefer something like ::firstname
... two :
s should very rarely happen in real live, and it's faster to type that than having to open and close parenthesis.
from i18n-node.
@enyo the problem is not the start the problem is the end in your examples That's why i would prefer %key% or ${key} that should normal never occur in a normal text.
from i18n-node.
In this case there is a very limited set of variable names that can be substituted, so it's not the same as with coffeescript variables (for example), since it just needs to go through all key names and replace :KEY_NAME
in the string.
The end is only a problem if you have two variables like firstName
and firstNameSuffix
, in which case :firstNameSuffix
could be confused with :firstName
+ Suffix
. But that could easily be handled by the script as well (always take the longest key name possible).
(And.. yes, my first comment on that was wrong. Having a space after doesn't change anything)
from i18n-node.
But this could create very unexpected behaviour. A clear end delimiter is much better. Because with one I can easily see which keys I have for translation and what is normal translation.
from i18n-node.
Mh. I think that it's extremely rare to have substitutions immediately followed by letters. Normally a substitution will be followed by a point, or space. So this behaviour will lead to confusion very rarely.
I like the :key_name
syntax because it's the same as in oracle's bind variables. Using ${keyName}
is a bit strange because, if you use coffeescript or jade, you're used to #{keyName}
. This could result in very confusing translation strings.
from i18n-node.
well and it should't interfere with possible templating engines, which leads to a configurable interpolation option anyway :)
from i18n-node.
That's the reason why I would vote for % % it's clear. Easy to read and shouldn't affect any template languages as far as I know. Oracles bind variables use : as the beginning and space as the end.
from i18n-node.
%key%
looks fine to me too. I'm just really opposed to ${key}
. (Also because it's common for programmers to write that, but the people writing translations mostly aren't programmers.)
from i18n-node.
+1
from i18n-node.
Any news on that?
from i18n-node.
I noticed the fork at matthias/i18n-node has support for mustache in the message strings
from i18n-node.
it's about to get merged - tracked in #76 I just wanted to get a quick review on it but didn't find time yet
from i18n-node.
released in 0.5.0 https://github.com/mashpie/i18n-node#mustache-support
from i18n-node.
Related Issues (20)
- how to pass a default translation if a phrase isnt existed in the en.json file HOT 3
- Locales are case sensitive HOT 3
- __h has strange behavior when he doesn't have the key HOT 1
- [Discussion] Contrast reports path traversal vulnerability HOT 4
- [Discussion] Allow a parser option to customize storage format HOT 2
- Maximum call stack size exceeded with some settings HOT 4
- Get string from locale file without substitution HOT 4
- passing a zero number value (0) incorrectly returns the full json string, brackets and all, without injecting the replacement value HOT 3
- When i18n is packaged into exe cannot be used, i18n directory cannot find the files under the directory path. HOT 3
- yml parser TypeScript and locale issues
- [Bug] translation API is returning `undefined` when provided locale is `undefined` or `null`
- There are no 0.15.1 release and tag.
- There are no 0.15.1 release and tag. HOT 1
- i18n ignores en.json language file HOT 1
- Error: Cannot find module Cyclic.sh sever HOT 1
- Problems with local files HOT 3
- ES Modules HOT 9
- feature request: support plurals with specific numbers HOT 5
- Readonly environment HOT 2
- `__n` not working as per documentation in the description
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 i18n-node.