koala-interactive/frenchkiss.js

Can the key be considered as a fallback to a language

Closed this issue · 1 comments

mkgn commented

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.

It's possible using onMissingKey props https://github.com/koala-interactive/frenchkiss.js#frenchkissonmissingkeyfn-function

// Will return the key as result if the key is not found
frenchkiss.onMissingKey((key, params, locale) =>  key);