首页 > 解决方案 > 在应用程序运行时获取特定的字符串资源翻译

问题描述

在 Xamarin.Android 中,我有德语翻译的字符串资源和默认的英语翻译。当应用程序运行时,它只获取德语字符串。如何在不更改设备区域设置的情况下使其获得英文翻译?

<string name="exampleResource">Example string</string>

<string name="exampleResource">Beispiel string</string>

我需要在运行时在 Xamarin 应用程序中显示的第二个翻译。

标签: androidxmlresourcestranslationandroid-resources

解决方案


您是否尝试过改变 resx 对象的文化?

 AppResources.Culture = new CultureInfo("en-EN");

推荐阅读