【问题标题】:Removing localization in liferay theme删除 liferay 主题中的本地化
【发布时间】:2016-01-25 18:24:14
【问题描述】:

我正在使用 Liferay 6.1 并开发了相同的主题。我的问题是当我加载主题时,head 部分包含巨大的链接,如下所示:

<link rel="alternate" hreflang="ar-SA" href="http://localhost/ar">
<link rel="alternate" hreflang="eu-ES" href="http://localhost/eu">
<link rel="alternate" hreflang="bg-BG" href="http://localhost/bg">
<link rel="alternate" hreflang="ca-AD" href="http://localhost/ca">
<link rel="alternate" hreflang="ca-ES" href="http://localhost/ca_ES">
<link rel="alternate" hreflang="zh-CN" href="http://localhost/zh">
<link rel="alternate" hreflang="zh-TW" href="http://localhost/zh_TW">
<link rel="alternate" hreflang="hr-HR" href="http://localhost/hr">
<link rel="alternate" hreflang="cs-CZ" href="http://localhost/cs">
<link rel="alternate" hreflang="da-DK" href="http://localhost/da">
<link rel="alternate" hreflang="nl-NL" href="http://localhost/nl">
<link rel="alternate" hreflang="nl-BE" href="http://localhost/nl_BE">
<link rel="alternate" hreflang="en-GB" href="http://localhost/en_GB">
<link rel="alternate" hreflang="et-EE" href="http://localhost/et">
<link rel="alternate" hreflang="fi-FI" href="http://localhost/fi">
<link rel="alternate" hreflang="fr-FR" href="http://localhost/fr">
<link rel="alternate" hreflang="gl-ES" href="http://localhost/gl">
<link rel="alternate" hreflang="de-DE" href="http://localhost/de">
<link rel="alternate" hreflang="el-GR" href="http://localhost/el">
<link rel="alternate" hreflang="iw-IL" href="http://localhost/iw">
<link rel="alternate" hreflang="hi-IN" href="http://localhost/hi">
<link rel="alternate" hreflang="hu-HU" href="http://localhost/hu">
<link rel="alternate" hreflang="in-ID" href="http://localhost/in">
<link rel="alternate" hreflang="it-IT" href="http://localhost/it">
<link rel="alternate" hreflang="ja-JP" href="http://localhost/ja">
<link rel="alternate" hreflang="ko-KR" href="http://localhost/ko">
<link rel="alternate" hreflang="lo-LA" href="http://localhost/lo">
<link rel="alternate" hreflang="nb-NO" href="http://localhost/nb">
<link rel="alternate" hreflang="fa-IR" href="http://localhost/fa">
<link rel="alternate" hreflang="pl-PL" href="http://localhost/pl">
<link rel="alternate" hreflang="pt-BR" href="http://localhost/pt">
<link rel="alternate" hreflang="pt-PT" href="http://localhost/pt_PT">
<link rel="alternate" hreflang="ro-RO" href="http://localhost/ro">
<link rel="alternate" hreflang="ru-RU" href="http://localhost/ru">
<link rel="alternate" hreflang="sr-RS" href="http://localhost/sr">
<link rel="alternate" hreflang="sr-RS-latin" href="http://localhost/sr_RS_latin">
<link rel="alternate" hreflang="sl-SI" href="http://localhost/sl">
<link rel="alternate" hreflang="sk-SK" href="http://localhost/sk">
<link rel="alternate" hreflang="es-ES" href="http://localhost/es">
<link rel="alternate" hreflang="sv-SE" href="http://localhost/sv">
<link rel="alternate" hreflang="tr-TR" href="http://localhost/tr">
<link rel="alternate" hreflang="uk-UA" href="http://localhost/uk">
<link rel="alternate" hreflang="vi-VN" href="http://localhost/vi">

我想删除不需要的语言。我希望删除这些链接,因为这不是 SEO 的好习惯。我想要一个主题的默认语言。我尝试在 portal-ext 文件中添加translations.disabled=true,但这没有奏效。

感谢您的任何建议。

【问题讨论】:

    标签: localization liferay-6 liferay-theme


    【解决方案1】:

    您必须限制要使用的语言环境,将“locales”属性添加到portal-ext.porterties。例如,要将其限制为英语和德语,您可以这样做

    locales=en_US,de_DE

    【讨论】:

    • 我已经添加了 locales=en_US 但所有其他链接仍然显示在 head 标签中。
    • 还有一件事可以帮助您指导我。每当我登录管理员时,链接都不会显示。但是当我部署主题时,它确实会显示如上所示的链接。
    • 谢谢 :) 关于语言环境,它应该可以工作。您可以在 Liferay 的新实例上试用它。我认为您的配置中还有其他问题。
    【解决方案2】:

    另见official wiki documentation

    我在这里引用它:

    删除不需要的语言

    默认情况下,Liferay 支持以下所有语言(摘自 Liferay 4.3.3 的 portal.properties):

    locales=ar_SA,ca_AD,ca_ES,zh_CN,zh_TW,cs_CZ,nl_NL,en_US,fi_FI,fr_FR,de_DE,el_GR,hu_HU,it_IT,ja_JP,ko_KR,fa_IR,pt_BR,ru_RU,es_ES,sv_SE,tr_TR,vi_VN

    如果我们只想支持英语、德语和西班牙语,我们只需删除不需要的语言环境,以便我们的语言环境值如下所示:

    locales=en_US,de_DE,es_ES
    

    【讨论】:

    • 虽然此链接可能会回答问题,但最好在此处包含答案的基本部分并提供链接以供参考。如果链接页面发生更改,仅链接的答案可能会失效。
    • 感谢@skyline75489 的建议。 :)
    【解决方案3】:

    portal-ext.properties 设置可以覆盖我在Control Panel &gt; Settings &gt; Display Settings &gt; Available Languages 的门户设置。我会说把它们放在那里是安全的。

    此外,在 SEO 部分有一个按页面选项来禁用那里的规范链接。

    【讨论】:

      【解决方案4】:

      在启动服务器后转到 web.xml 并删除语言映射 url。

      url--tomcat-7.0.42\webapps\ROOT\WEB-INF

      【讨论】:

        猜你喜欢
        • 2020-05-30
        • 2019-01-12
        • 1970-01-01
        • 2021-09-04
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多