C# Android本地化Resx资源字符串到Android资源字符串
我已经创建了AppResource.Resx和AppResource.da.Resx,并且在string.XML中还有一个值为da=>string.XML的资源字符串C# Android本地化Resx资源字符串到Android资源字符串,c#,xamarin.android,localization,visual-studio-2019,C#,Xamarin.android,Localization,Visual Studio 2019,我已经创建了AppResource.Resx和AppResource.da.Resx,并且在string.XML中还有一个值为da=>string.XML的资源字符串 AppResources.Culture = new CultureInfo("da-DK"); Java.Util.Locale.Default = new Java.Util.Locale("da", "DK");
AppResources.Culture = new CultureInfo("da-DK");
Java.Util.Locale.Default = new Java.Util.Locale("da", "DK");
Resources.Configuration.Locale = Java.Util.Locale.Default;
Resources.UpdateConfiguration(Resources.Configuration, Resources.DisplayMetrics);
var sfs = Resources.GetText(Resource.String.AboutLabel);
var dfdd = AppResources.AboutLabel;
Finish();
Intent intent = new Intent(this, this.Class);
StartActivity(intent);
var dffdsadd = AppResources.AboutLabel;
var fdsfdsafs = Resources.GetText(Resource.String.AboutLabel);
这里是我试图设置或更新android的资源,这些资源是从AppResource.resx文件获取的,但不更新资源?
如何将AppResources字符串与android字符串绑定,以实现本地化和值访问?导入文件、翻译文件、导出文件以用于Xamarin移动应用程序时,可以使用以下文件格式之一:
- Xamarin.Forms的RESX文件
- Xamarin.iOS本机平台的本地化.strings文件
- 用于Xamarin.Android本机平台的Android字符串文件
你说得对,但我们在Xamarin.Android和Xamarin.IOS之间共享了DAL。因此,我们希望在Android和IOS之间共享相同的资源。NativeiOS需要我们在其Info.plist文件中提及我们的Xamarin项目中使用的本地化。您可以下载示例代码以供参考。您可以遵循MVVM模式(可以使用MVVMCross-Xamarin.Native)并使用相同的资源将属性绑定到Android和iOS的文本控件核心视图模型:-公共字符串SharedAppResourceText{get;set;}=AppResources.SharedAppResourceValue;| | |Android:-| | | iOS:-set.Bind(TestLabel).For(“Title”).To(vm=>vm.SharedAppResourceText);