Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/vim/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Windows phone 8.1 在运行时更改通用应用程序中的语言_Windows Phone 8.1_Windows 8.1_Win Universal App - Fatal编程技术网

Windows phone 8.1 在运行时更改通用应用程序中的语言

Windows phone 8.1 在运行时更改通用应用程序中的语言,windows-phone-8.1,windows-8.1,win-universal-app,Windows Phone 8.1,Windows 8.1,Win Universal App,我想在运行时更改我的通用应用程序的语言,而不是在重新启动应用程序时-, 我尝试了以下代码: private void ArabicRadioButton_Checked(object sender, RoutedEventArgs e) { if (!loaded) return; var localSettings = Windows.Storage.ApplicationData.Current.LocalSettings; lo

我想在运行时更改我的通用应用程序的语言,而不是在重新启动应用程序时-, 我尝试了以下代码:

   private void ArabicRadioButton_Checked(object sender, RoutedEventArgs e)
    {
        if (!loaded) return;
        var localSettings = Windows.Storage.ApplicationData.Current.LocalSettings;
        localSettings.Values["ArabicSelected"] = true;
        Windows.Globalization.ApplicationLanguages.PrimaryLanguageOverride = "ar-EG";
        SettingsHeader.Text = "الاعدادات";
        (Window.Current.Content as Frame).Navigate((Window.Current.Content as Frame).Content.GetType());
        (Window.Current.Content as Frame).GoBack();

    }

    private void EnglishRadioButton_Checked(object sender, RoutedEventArgs e)
    {
        if (!loaded) return;
        var localSettings = Windows.Storage.ApplicationData.Current.LocalSettings;
        localSettings.Values["ArabicSelected"] = false;
        Windows.Globalization.ApplicationLanguages.PrimaryLanguageOverride = "en-US";
        SettingsHeader.Text = "Settings";
        (Window.Current.Content as Frame).Navigate((Window.Current.Content as Frame).Content.GetType());
        (Window.Current.Content as Frame).GoBack();


    }
语言没有正确地变化;它有时改变,有时不改变。 我不知道Windows 8.1和Windows phone 8.1中出现此问题的原因是什么。请尝试:

var culture = new CultureInfo("en-US");
                    Windows.Globalization.ApplicationLanguages.PrimaryLanguageOverride = culture.Name;
                    CultureInfo.DefaultThreadCurrentCulture = culture;
                    CultureInfo.DefaultThreadCurrentUICulture = culture;
                    (Window.Current.Content as Frame).FlowDirection = Windows.UI.Xaml.FlowDirection.LeftToRight;
                    var loader = new Windows.ApplicationModel.Resources.ResourceLoader();
此外,将ar EG的流向设置为:

(Window.Current.Content as Frame).FlowDirection = Windows.UI.Xaml.FlowDirection.RighttoLeft;
对于美国:

(Window.Current.Content as Frame).FlowDirection = Windows.UI.Xaml.FlowDirection.LeftToRight;

感谢您的回复..语言正确更改,但仅在重新启动应用程序时更改;当我更改语言并导航到其他页面时,流方向只会更改,但语言仍保持不变,但当我重新启动应用程序时,它会工作。是的,您需要重新启动应用程序才能获得更改的语言。有人能帮我在运行时更改语言吗?签出此链接:。我可以重置Windows应用商店应用程序的语言。