Im currently working on a platform that has multi-language options and also the language is defined by IP. So Im trying to build an architecture for testing both scenarios dynamically… The domain is always the same: Example: www.page.com (If you are logged in from Britain the web application is loaded in English, if you are visiting the page from France the page is loaded in French.)
I have an idea to make different abstract classes with error messages for example:
public class ErrorMessagesEN {
public static final String MANDATORY_FIELD = “This field is mandatory…”;
public static final String SOME_OTHER_ERROR_MSG = “Some error message on english”
// etc…..
}
public class ErrorMessagesFR {
public static final String MANDATORY_FIELD = “Error message in French”
public static final String SOME_OTHER_ERROR_MSG = “Some error message on
French”
// etc…..
}
In the test method i provide parameter “EN” or “FR” for example:
homepage.signIn(String location)
So is there any option to make for example:
if (location==”EN”) {
// load the ErrorMessageEN
// etc……
}
The keys for the Strings are the same but the classes are different, so how can I provide different imports of the classes by the location parameter for example? Or are there any better approaches for this situation? Any links or ideas?
Thanks!
PS. If you need more info to help me please ask! 🙂