.net - 尝试以 xaml xamarin 形式进行本地化

标签 .net xaml xamarin xamarin.forms resourcemanager

我正在尝试使用 Xamarin 表单的 xaml 本地化指南中解释的 TranslateExtension 方法。但是我收到错误。

Unhandled Exception:

System.Resources.MissingManifestResourceException: Could not find any resources appropriate for the specified culture or the neutral culture.  Make sure "CashRegisterApp.Resx.AppResources.resources" was correctly embedded or linked into assembly "CashRegisterApp.Android" at compile time, or that all the satellite assemblies required are loadable and fully signed. occurred

调试后,我注意到资源文件的扩展名由于某种原因设置为 .resources。由于这不是资源管理器的公共(public)成员,我不确定如何将其设置为使用 resx 或 resw 文件。

enter image description here

最佳答案

您需要为您的资源指定当前区域性。

var culture = "en-US";

AppResources.Culture = new System.Globalization.CultureInfo(culture);

关于.net - 尝试以 xaml xamarin 形式进行本地化,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48913363/

相关文章:

c# - 如何从 XDocument 获取 Xml 作为字符串?

.net - 线程安全对象 - 静态还是非静态?

c# - WPF 绑定(bind) ItemsControl 中的字符串值列表

android-intent - 关闭的应用程序未调用 Xamarin Android OnNewIntent

c# - 应用程序被杀死时无法接收 APNS

xamarin - Xamarin 中的可共享控件/ View

c# - 确保 C# 中静态方法的线程安全

c# - 有没有办法让 Int 变量等于(==)数组中存储的所有数字?

c# - WinRT 媒体元素 : Detect changes from fullscreen to normal when IsFullWindow is true and AreTransportControlsEnabled is true

Silverlight:滚动查看器仅在内容溢出时出现?