Click here to Skip to main content
15,896,154 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have application that has different language support.
Besides UI I need language settings when showing Exception errors, creating reports and some other stuff.
My current solution for that is :
C#
public enum SupportedLanguage
{
    English, German ....
} 
public abstract class LanguageSettings
{
    static SupportedLanguage _currentLanguage; 
    public static SupportedLanguage CurrentLanguage
    { 
        get { return _currentLanguage; }
        set
        {
            if (_currentLanguage != value)
            {
                _currentLanguage = value;
                ChangeCurrentLanguage();                     
            }
        }
    }
    void static ChangeCurrentLanguage()
    {
        // XML Loading stuff
    }
    // Language
    public static string ImagesLoadError { get; set; }
    public static string ReportGenerationError { get; set; }
    public static string SaveReportMessage { get; set; }
    public static string Button1Text{ get; set; }
    // .
    // .
    // .


I know there's a many better solutions to this problem, please give me one :D

Thanks


Nikola
Posted
Comments
Jaganathan Bantheswaran 17-Feb-12 5:50am    
You can get the language from CurrentLanguage property right...
cCoderNN 17-Feb-12 9:18am    
Yes

1 solution

 
Share this answer
 
Comments
cCoderNN 17-Feb-12 9:19am    
Thanks, I will use this :)
SteveAdey 17-Feb-12 9:54am    
Cool, any problems, give me a shout ;)
cCoderNN 18-Feb-12 9:10am    
Well I need some help now.
I need to use LanguageService from this sample at runtime also.
How to do that, without creating new instance and loading languages ?
Thank you
SteveAdey 18-Feb-12 11:10am    
I take it you mean that you would like to add new language strings without adding them to an xml file first???
cCoderNN 18-Feb-12 11:28am    
I want to use same instance of LanguageService (property of TranslatorExtension) in my ViewModel, without loading xml data via Translator and ViewModel

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900