Open moyoteg opened 5 years ago
You are not using it correct. As mentioned in the documentation: https://github.com/stefalda/react-localization#typescript-support you can do something like this:
export interface IStrings extends LocalizedStringsMethods{
home_header: string;
home_title: string;
provider_header: string;
provider_title: string;
carts_header: string;
carts_title: string;
}
public strings: IStrings;
this.strings = new LocalizedStrings({
it: {
home_header: "Punti",
home_title: "Tempo"
provider_header: "Uno",
provider_title: "Roma"
carts_header: "Prova",
carts_title: "Testo"
},
en: {
home_header: "Score",
home_title: "Time"
provider_header: "One",
provider_title: "Rome"
carts_header: "Check",
carts_title: "Test"
}
});
And try to do some stuff or add logic to match the view depending strings.
I have:
mainViews = ['Home', 'Providers', 'Carts']
I want:
mainViews = [LocalizedStrings.home, LocalizedStrings.providers, LocalizedStrings.carts]
so that I can:
mainView.map( (text, index) => { // code goes here })...
result:
undefined