David
David

Reputation: 11

Culture resource files

I'm working on an ASP.NET app

I have a couple of resource files with the different languages I can support example: Language.en.resx Language.pt.resx

Is there any way to get, for example, a list with all the different languages dynamically?

Upvotes: 1

Views: 232

Answers (1)

Nasser Hadjloo
Nasser Hadjloo

Reputation: 12610

If you are looking for a way which determine how many ( and what ) languages you localize for your application. There is no solution. You have to write a parser which look in a series of sub directories in your application ( or given ) path. the read and store the name of Resx files into a list.

Finally you have to split the name of Resx file with Dot (split('.')) and seperate the language part of the Resx files like

  string[] myString = new string[MyResxList.lenght];
  for (int i=0; i<=MyResxList.lenght;i++)
     myString[i] = MyResxList[i].toString().split('.')[3];

note that above code is a snippet and I wrote it here so you have to debugit if it's necessary

then you should remove the duplicates and return the List

Upvotes: 1

Related Questions