i18n-webpack-plugin icon indicating copy to clipboard operation
i18n-webpack-plugin copied to clipboard

Support fallback language when using tokens

Open sorahn opened this issue 9 years ago • 2 comments

We have some fairly long strings on our site, so we were going to opt for using tokens like this __("my_string_key"), the json like this:

// en.json
{
  "my_string_key": "English String"
}

// de.json
{
  "my_string_key": "Deutsche Zeichenfolge"
}

However, I was wondering if its still possible to have the this plugin set up a default.

Currently if you use languages = {en: null, de} this works by assuming that the english strings are in the code, and it falls back to using that. We would be looking for a way to specify what language to display if the german strings are missing.

Thanks.

sorahn avatar Feb 01 '16 21:02 sorahn

@sorahn have you managed to find the answer?

102 avatar Sep 13 '16 05:09 102

@102 Not in webpack. We ended up using http://i18next.com/ which gave us full control over how we get updates, and which languages are baked in and what order of fallbacks they go through

sorahn avatar Sep 13 '16 21:09 sorahn