S
Shapper
Hello,
I need to create a table with for localization. Something like:
"Hello", "en"
"Bounjour", "fr"
"Olá", "pt"
For this I could simply use a Dictionary<String, String> so something like:
public class TranslationDictionary : Dictionary<String, String> { }
The problem is one of this items should be used as a key.
I will have a method that does the following:
Get(String key, String language);
If I pass the key "Hello" and the language "en" then I return "Hello".
If I pass the key "Hello" and the language "pt" then I return "Olá".
So when I define the dictionary I need to define which item is the key.
And I would also like to create a Fluent Interface. Something like:
translations.For("Hello", "en").Add("Bounjour", "fr").Add("Olá", "pt");
The item in For would be the one used as key ... And the others are translations.
How can I create a Class to hold this data and use such an interface?
Thank You,
Miguel
I need to create a table with for localization. Something like:
"Hello", "en"
"Bounjour", "fr"
"Olá", "pt"
For this I could simply use a Dictionary<String, String> so something like:
public class TranslationDictionary : Dictionary<String, String> { }
The problem is one of this items should be used as a key.
I will have a method that does the following:
Get(String key, String language);
If I pass the key "Hello" and the language "en" then I return "Hello".
If I pass the key "Hello" and the language "pt" then I return "Olá".
So when I define the dictionary I need to define which item is the key.
And I would also like to create a Fluent Interface. Something like:
translations.For("Hello", "en").Add("Bounjour", "fr").Add("Olá", "pt");
The item in For would be the one used as key ... And the others are translations.
How can I create a Class to hold this data and use such an interface?
Thank You,
Miguel