I have different classes called English, Spanish, Frenchetc .:
Class English{
String name = "English";
String alias = "ENG";
}
Class French{
String name = "French";
String alias = "Fre";
}
Similar to other language classes.
And another class called Language:
Class Language{
String name = "";
String alias = "";
}
Depending on my requirements, I want to use English / French / Spanish for my language.
Class ABC{
main(){
Language lan = new Language();
Object obj = getObject(1);
if(obj instanceof English){
lan.name = ((English)obj).name;
lan.aliasName = ((English)obj).aliasName;
}
}
}
If I have 10 languages, do I need to write the same code for 10 different languages? In this case, how can I make one method and pass these arguments as parameters? Something like that:
setVariablesForLanguage(String className, Object obj)
Here I showed only 2 variables, but my class will contain more than 100 variables. My actual re-examination - I want to set my language variables in one of these languages ..