Comments (5)
Actually, I'll wait on how mashpie will treat your similar issue mashpie#178 to see what to do
from i18n-node-2.
I guess that would be possible by using a function / or a custom object
directory: {
0: 'There is %n directory',
1: 'There is %n directory',
'more': 'Thereis %n directories'
}
A function would be simpler but it can't work in JSON files. Some thoughts @jeresig ?
from i18n-node-2.
New idea : conditions as keys
directory: {
0: 'There is 0 directory',
1: 'There is 1 directory',
'>1': 'There is %n directories'
}
Which would require some sort of eval/parsing. Which is pretty difficult
from i18n-node-2.
well, rails has that solved in its ActiveSupport
gem. They have all kind of pluralization with simple rules.
from i18n-node-2.
Gettext format solves this by embedding count expression in locale file. The idea is to use empty key in translation file to store some additional information, among them - language rules.
The example of such rules can be seen in test files of another JS translator: https://github.com/messageformat/Jed/blob/master/test/tests.js
I suppose, that upon loading transation file, such rule can be transformed to JS function and then used to fetch appropriate index from different translation forms.
As the gettext format is being widely used on server side and it's proven, maybe this is the way to go.
from i18n-node-2.
Related Issues (20)
- Support language fallbacks HOT 4
- Requesting changelog for npm version 0.7.0 HOT 2
- How to access i18n object in React components? HOT 1
- Feature Request: override current language manually HOT 2
- Did module create tmp files?
- What is the proper way to call i18n-2 accross main.js and renderer.js HOT 1
- i18n should be silent by default HOT 2
- Using i18n in js files HOT 3
- Uncaught ReferenceError: __ is not defined HOT 3
- unexpected error writing files HOT 1
- Large HB project, seems to write to JSON file over and over even with no changes HOT 6
- Issue with getting value from i18n.__("Hello") HOT 3
- The sprintf package is deprecated in favor of sprintf-js HOT 2
- setLocaleFromQuery() isn't working HOT 1
- New strings go to user-defined language
- When in Dev Mode JSON is overwritten when accidentally invalidating the JSON language file.
- Problem merging locale file with base file
- Access to the i18n outside of a request
- i18n-2 upd
- how to add support for ICU Format
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-2.