并非所有字符串都已本 [英] Not all strings localized

查看:93
本文介绍了并非所有字符串都已本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个利用本地化的MVC5 Razor项目。但是并非所有字符串都已本地化即使在同一页面上,也会有一些本地化(在这种情况下是瑞典语),而其他则不是。比如像这样的动作链接:



I am working on a project in MVC5 Razor which utilizes localization. However not all strings are localized. Even on the same page some will be localized (in Swedish in this case) and others aren't. For instance an actionlink like this:

@Html.ActionLink(@Resources.MyProject.UI_NewFAQuestion, "Create", new { returnUrl = Request.Url.AbsoluteUri })





我也试过这个变种,我在某处阅读是必要的,但它也显示了英文(默认)字符串:



I've tried this variant as well that I read somewhere was necessary, but it shows the english (default) string as well:

@Html.Raw(string.Format("{0}", Html.ActionLink(@Resources.MyProject.UI_NewFAQuestion, "Create", new { returnUrl = Request.Url.AbsoluteUri })))










@Resources.MyProject.[Resource Name]

将显示英语(默认语言)无论如何,但调用

will show in English (default language) regardless, but calls to

@Html.LabelFor()

将使用本地化字符串。





我放入一个断点并检查CurrentUICulture给了我这个:

will use the localized string.


I put in a breakpoint and checking CurrentUICulture gave me this:

Thread.CurrentThread.CurrentUICulture
{sv}
    calendar: null
    Calendar: {System.Globalization.GregorianCalendar}
    CompareInfo: {CompareInfo - sv}
    compareInfo: {CompareInfo - sv}
    CreatedDomainID: 2
    cultureID: 127
    CultureTypes: NeutralCultures | InstalledWin32Cultures | FrameworkCultures
    DateTimeFormat: {System.Globalization.DateTimeFormatInfo}
    dateTimeInfo: {System.Globalization.DateTimeFormatInfo}
    DisplayName: "Swedish"
    EnglishName: "Swedish"
    HasInvariantCultureName: false
    IetfLanguageTag: "sv"
    IsNeutralCulture: true
    IsReadOnly: false
    IsSafeCrossDomain: true
    KeyboardLayoutId: 29
    LCID: 29
    m_consoleFallbackCulture: null
    m_createdDomainID: 2
    m_cultureData: {System.Globalization.CultureData}
    m_dataItem: 0
    m_isInherited: false
    m_isReadOnly: false
    m_isSafeCrossDomain: true
    m_name: "sv"
    m_nonSortName: "sv"
    m_parent: {}
    m_sortName: "sv"
    m_useUserOverride: false
    Name: "sv"
    NativeName: "svenska"
    NumberFormat: {System.Globalization.NumberFormatInfo}
    numInfo: {System.Globalization.NumberFormatInfo}
    OptionalCalendars: {System.Globalization.Calendar[1]}
    Parent: {}
    Region: {SE}
    regionInfo: {SE}
    SortName: "sv"
    textInfo: null
    TextInfo: {TextInfo - sv}
    ThreeLetterISOLanguageName: "swe"
    ThreeLetterWindowsLanguageName: "SVE"
    TwoLetterISOLanguageName: "sv"
    UseUserOverride: true



所以我认为它应该有效


So I would think it should work

推荐答案

这篇关于并非所有字符串都已本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆