Coder Social home page Coder Social logo

koala-interactive / frenchkiss.js Goto Github PK

View Code? Open in Web Editor NEW
801.0 801.0 18.0 245 KB

The blazing fast lightweight internationalization (i18n) module for javascript

License: MIT License

JavaScript 96.73% HTML 3.27%
frenchkiss i18n internationalization interpolation javascript language localization translation

frenchkiss.js's People

Contributors

dependabot[bot] avatar eduardoltorres avatar floriansimon1 avatar ftonato avatar lucbarbier-tech avatar muzishell avatar stephanhoyer avatar vthibault avatar zoontek avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

frenchkiss.js's Issues

Ordinal suffix configuration

Hi,

How would one go about configuring the ordinal suffix usage for a language like English, for example?

E.g.

  • 1 -> 1st
  • 2 -> 2nd
  • 3 -> 3rd
  • 4 - 4th
  • 11 - 11th
  • 21 - 21st
  • 22 - 22nd
  • etc

Thank you for the great library!

[Suggestion] Change the order of parameters

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.

See my suggested code below:
set-function

Let me know, what do you think about it.

Code generation from strings disallowed for this context

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

Can the key be considered as a fallback to a language

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.

[Suggestion] Add support for nested objects

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.

Extraction Tool

Nice library! Just wondering whether there's a way to extract the texts to external file such as JSON for further translation?

CSP compatibly

I get with frenchkiss a unsafe-eval error, because of a new function.

With the current implementation frenchkiss is not CSP compatible.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.