0

I am working on a metro app which provides a change language option in app. I want that on change of language textbox input language also get change. and it should not depends on system language.

0

2 Answers 2

1

I use these codes: First of all you must find the name of the culture language you want. method "GetInutLanguageByName" will return the language that you requested Then you will check whether you installed the requested language or not, if yes then return the requested language. Then change the input language very easy...

private static InputLanguage GetInutLanguageByName(string layOut)
    {
        foreach (InputLanguage lng in InputLanguage.InstalledInputLanguages)
        {
            if (lng.Culture.DisplayName == layOut)
            {
                return lng;
            }
        }
        return null;

    }

private void SetKeyboardLayout(InputLanguage Layout)
    {
        InputLanguage.CurrentInputLanguage = Layout;
    }

private void FirstNameTextBox_Enter(object sender, EventArgs e)
    {

        SetKeyboardLayout(GetInutLanguageByName("Persian"));

    }
Sign up to request clarification or add additional context in comments.

Comments

0

Firstly, you need to make sure that the language you want is installed in OS, and it is in the list of INSTALLED INPUT LANGUAGES (check the language bar in control panel under Language and Regional Settings).. If its not in language bar, add it.. e.g. you want to change app language to "FRENCH".. you would need to create a new resource file for every language you want to change in app, and then change the current thread's Culture Property.. Are you familiar with resources file (.resx) and Culture Info Class??

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.