Tag: 本地化

通过AJAX使用页面方法/ Web服务进行ASP.NET本地化

那是满口的…… 这是问题,我们正在通过AJAX调用页面方法(实质上是Web服务)进行一些客户端validation。 我们还在页面上添加了一个下拉列表来选择您的语言,并创建了一个inheritance自Page的类,该类根据下拉选项初始化本地化。 当通过AJAX调用页面方法时,页面没有正常实例化,因此没有进行本地化的初始化。 我已经考虑过将语言选择保存到会话中,但这并不能解决问题,因为每个页面方法都必须重新初始化本地化才能获得正确的语言文件。 有关如何处理页面方法或Web服务中的动态本地化的任何想法? 这是我们第一次涉足本地化,所以我希望我错过了一些明显的东西……

本地化资源中的文本样式

我对windows-phone的本地化资源有疑问。 比方说,我的Resources文件中有一个字符串,它应该如下所示: 这是一些文字。 该值为粗体。 这个是斜体。 并且所有存储在单个字符串字段中。 我怎么能在参考资料本身中定义像粗体或斜体这样的文本样式? 我知道,我可以预定义一些自定义字体,如下所示: … 然后在页面中添加为{StaticResource CustomBold} ,但如果字符串字段中的整个文本为粗体,则可以是解决方案。 如果我想在短语的中间加粗一个单词怎么办? 我想使用原生的c#-style Resources(即字符串名称 – >字符串值),而不是编写不同的实现。

为什么语言不会在回发时发生变化?

我的下拉列表中有一个语言列表,其中包含en-NZ,en-US等forms的值,但该页面不会更改回发语言,因为我的语言代码错误。 有人可以查看我的代码,并告诉我改变我的页面语言我做错了什么 而且我的lbllanguage.Text会在第二次回发时发生变化,所以它假设在第一次单击时更改ChangeLanguage_Click事件 主页: protected void Page_PreRender(object sender, EventArgs e) { string Culture = (HttpContext.Current.Profile as ProfileCommon).Preferences.Culture; if (ddlChangeLanguage.Items.FindByValue(Culture) != null) { ddlChangeLanguage.SelectedValue = (HttpContext.Current.Profile as ProfileCommon).Preferences.Culture; } } protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { List languages = CultureInfo.GetCultures(CultureTypes.SpecificCultures).OrderBy(x => x.Name).ToList(); SortedDictionary sortedLanguages = new SortedDictionary(); foreach (CultureInfo language in languages) […]

System.Convert.ToSingle()问题,(1.5)vs(1,5)

我正在用C#编写程序,用于在模型格式之间进行转换。 模型格式的数字为文本,例如“-0.136222”。 我可以使用System.Convert.ToSingle()将其转换为浮点数。 但是在德国,我们使用逗号作为小数点(-0,136222),System.Convert就此选择了。 现在我遇到的问题是它没有识别小数点,因为它需要逗号。 简而言之; 我们有这个:“ – 0.136222”我们得到这个:-0136222.0f,因为它期望这个:“ – 0,136222” 我可以告诉系统只为我的程序识别逗号作为小数点吗? 解决方法不起作用,因为它需要可移植(到其他国家)。

可本地化的WPF应用程序 – UICulture设置导致资源问题

我想创建一个可本地化的WPF应用程序。 我按照AssemblyInfo.cs文件的注释中的说明操作: //In order to begin building localizable applications, set //CultureYouAreCodingWith in your .csproj file //inside a . For example, if you are using US english //in your source files, set the to en-US. Then uncomment //the NeutralResourceLanguage attribute below. Update the “en-US” in //the line below to match the UICulture setting in the project […]

Microsoft Sans Serif字体未在中文本地化Windows中使用

场景: 与“中文”Windows 7企业版相比,UI界面元素在美国英语Windows 7企业版上使用不同的字体,即使所有本地化包和语言都设置为英语。 在WinForms代码隐藏中,FontFamily未明确定义并依赖于默认值。 英语: 中文: 几个问题: 1)中文Windows使用的字体是什么? 2)这种安装有什么不同会导致它使用该字体? 3)如何设置环境来复制它? 它是Windows 7上的安装时选项,在已安装的Windows 7实例上切换UI和System Culture时无法获得吗? FWIW: 我检查了C:\ Windows \ Fonts,它的版本和大小与“Microsoft Sans Serif Regular”相同

你如何处理本地化/ CultureInfo

某些方法(如string.Format()或.Parse())需要IFormatProvider。 你是如何提供的? 在封闭环境应用程序中(您知道永远不需要本地化),您是否只是跳过它并在没有IFormatProvider的情况下调用方法? 在可能已本地化的应用程序中,您是否考虑了每个方法调用的正确值,并将其设置在那里? 这可能是’CultureInfo.CurrentCulture’或’CultureInfo.CurrentUiCulture’。 或者您是否使用“MyUiCultureInfo”和“MyCultureInfo”等全局变量来通过更改其值来切换本地化? 你如何以及在哪里存储这些变量? 在开发库或框架时有什么需要考虑的 – 在这种情况下如何处理本地化?

在ASP.NET MVC 2中本地化错误消息(默认validation属性)

我正在开发一个多语言网站,我希望本地化大多数ValidationAttribute的validation错误消息,例如[Requried] 我知道这可以像Phil Haack在本文中所展示的那样完成。 [Required(ErrorMessageResourceType = typeof(Resources), ErrorMessageResourceName = “Required”)] 但我想按照我在这里使用自定义validation属性的方式自定义错误消息: [AttributeUsage(AttributeTargets.Field | AttributeTargets.Property, AllowMultiple = false, Inherited = true)] public sealed class ValidateminRequiredNonalphanumericCharactersAttribute : ValidationAttribute { private const string _defaultErrorMessage = // Message From Resource Here ( i will be using two variables in this message ) private readonly int _minnonalphanumericCharactersCounter = Membership.Provider.MinRequiredNonAlphanumericCharacters; public ValidateminRequiredNonalphanumericCharactersAttribute() […]

没有资源文件怎么做本地化?

来自互联网的文章,他们都在资源文件xxxx.resx上进行本地化 有没有办法从数据库中读取资源?

ASP Net MVC – validation消息的本地化

我在asp net mvc 5应用程序中遇到了validation消息本地化的问题。 我用它进行本地化: 路线配置: [Internationalization] public class RouteConfig { public static void RegisterRoutes(RouteCollection routes) { routes.IgnoreRoute(“{resource}.axd/{*pathInfo}”); routes.MapRoute(“DefaultLocalized”, “{language}-{culture}/{controller}/{action}/{id}”, new { controller = “Home”, action = “Index”, id = “”, language = “de”, culture = “DE” }); routes.MapRoute( name: “Default”, url: “{controller}/{action}/{id}”, defaults: new { controller = “Home”, action = “Index”, id = UrlParameter.Optional […]