I am having the following structure in my project:
locale
|_ nl
| |_ country.ts
|_ en
| |_ country.ts
|_ de
|_ country.ts
Each country.ts
contains a lookup object for the translation:
export default {
'AFG': 'Afghanistan',
'ALA': 'Åland',
'ALB': 'Albanië',
'DZA': 'Algerije',
Currently I am using the NL file like:
import CountryNL from 'locale/nl/country';
let locale = CountryNL['ALB'];
However to use the other locales I need dynamic importing a module. As stated in Importing modules using ES6 syntax and dynamic path this is not possible.
What would be the best approach to dynamically get the correct language file ?