koala-interactive / frenchkiss.js Goto Github PK
View Code? Open in Web Editor NEWThe blazing fast lightweight internationalization (i18n) module for javascript
License: MIT License
The blazing fast lightweight internationalization (i18n) module for javascript
License: MIT License
Hi,
How would one go about configuring the ordinal suffix usage for a language like English, for example?
E.g.
Thank you for the great library!
Nice library! Just wondering whether there's a way to extract the texts to external file such as JSON for further translation?
My application is a .Net core app which supports multi-language. At the server the way we call to get a translation (based on the client's culture) is something like below.
LanguageStore["Hello there"]
The point here is that fall back value is the key and it's the English locale (So we don't have a separate english resource file).
I know in your library, we can have a fall back store, but is it possible to do something like above? So the fall back is basically the key itself which is English.
For organization purposes it is nice to have a definition file with nested objects. Just a random example:
frenchkiss.set('en', {
fruits: {
apple: 'An apple',
banana: 'A banana'
},
vegetables: {
carrot: 'A carrot',
daikon: 'A daikon'
}
})
I would then use some lodash syntax and access them by t('fruits.banana') => 'A banana'
.
Would this be out of scope for frenchkiss or something that could be added? Right now I'm converting our definition file to follow this dot syntax but to have it supported by frenchkiss would be really nice.
I'm French too, and I'm pretty sure "I did not bought apples!" is not proper English :)
Alternatively:
Cheers
Hello,
I think would be interesting to change the order of parameters in the set function, in this way we can assume that the language
parameter will receive the default _locate
, avoiding having to repeat code.
Let me know, what do you think about it.
There should be typescript support to support more possible projects.
EvalError: Code generation from strings disallowed for this context
at Function (<anonymous>)
at o (/Users/v0/Projects/remix-i18n/documents/node_modules/frenchkiss/dist/esm/frenchkiss.js:6:706)
at g (/Users/v0/Projects/remix-i18n/documents/node_modules/frenchkiss/dist/esm/frenchkiss.js:6:1389)
at Object.b (/Users/v0/Projects/remix-i18n/documents/node_modules/frenchkiss/dist/esm/frenchkiss.js:6:1439)
at Index (/Users/v0/Projects/remix-i18n/documents/app/routes/$.tsx:63:18)
at processChild (/Users/v0/Projects/remix-i18n/documents/node_modules/react-dom/cjs/react-dom-server.browser.development.js:3352:14)
at resolve (/Users/v0/Projects/remix-i18n/documents/node_modules/react-dom/cjs/react-dom-server.browser.development.js:3269:5)
at ReactDOMServerRenderer2.render (/Users/v0/Projects/remix-i18n/documents/node_modules/react-dom/cjs/react-dom-server.browser.development.js:3752:22)
at ReactDOMServerRenderer2.read (/Users/v0/Projects/remix-i18n/documents/node_modules/react-dom/cjs/react-dom-server.browser.development.js:3689:29)
at renderToString2 (/Users/v0/Projects/remix-i18n/documents/node_modules/react-dom/cjs/react-dom-server.browser.development.js:4297:27)
react ssr
It would be nice to add github actions so that PRs can be automatically checked for regressions.
Or is there any way I can get the compiled code
and/or pluralCode
that being the parts of the new Function
and compileCode
method?
I get with frenchkiss a unsafe-eval error, because of a new function
.
With the current implementation frenchkiss is not CSP compatible.
Coming from Polyglot, this would enable the special _
param to supply the default value.
https://github.com/airbnb/polyglot.js?files=1#polyglotprototypetkey-interpolationoptions
let missingKeyHandler = (key, params, lc) => key;
...
missingKeyHandler(key, params, lc);
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.