I am working on a windows application which downloads a template from http URL using WebClient.
I have to implement localization in report. Application will always be in default language(English) and i will have a variable which will hold the language in which report has to be printed. Report template will be downloaded on the basis of language. Report templates are different for each language having naming convention like
default: http://www.xyz.com/report/report.htm
English: report.en-US.htm, Spanish: report.es-ES.htm Portuguese: report.pt-PT.htm
Do i have ti use switch..case for each language or it is possible any other way.
If the filename format will stay same you could do this
string cultureCode = "en-US"; //set current locale
Uri reportUri = new Uri(String.Format("http://www.xyz.com/report/report.{0}.htm", cultureCode), UriKind.Absolute);
That way it'll dynamically create the URI for you with the relevant locale added. As a quick method
public void Uri GetLocalReportUri(string cultureCode)
{
return new Uri(String.Format("http://www.xyz.com/report/report.{0}.htm", cultureCode), UriKind.Absolute);
}