[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"blog-omekas如何製作多國語系檔案":3},{"id":4,"slug":5,"title":6,"description":7,"content":8,"date":9,"image":10,"imageAlt":6,"author":11,"categories":14,"path":17,"minRead":18},70,"omekas如何製作多國語系檔案","[OmekaS]如何製作多國語系檔案","如何製作多國語系檔案 在Omeka S中能切換不同的語言，因此在修改或製作主題\u002F模組時就得考慮加入多國語系，至 […]","\u003Ch1>如何製作多國語系檔案\u003C\u002Fh1>\n\u003Cp>在Omeka S中能切換不同的語言，因此在修改或製作主題\u002F模組時就得考慮加入多國語系，至少做個對應中文與英文\u003C\u002Fp>\n\u003Cp>製作方式不難，採用的就是gettext(i18n)的作法\u003C\u002Fp>\n\u003Cp>首先需要*.po(zh_TW.po) 如果是繁體中文，就用對應的語言簡稱(zh_TW)\u003C\u002Fp>\n\u003Cp>內容大概像這樣\u003C\u002Fp>\n\u003Cpre>\u003Ccode># Translation for the XXX plugin for Omeka.\n# Copyright (C) 2011 Roy Rosenzweig Center for History and New Media\n# This file is distributed under the same license as the Omeka package.\n# \n# Translators:\n# billxu &lt;billxu0521@gmail.com&gt;, 2020\nmsgid &quot;&quot;\nmsgstr &quot;&quot;\n&quot;Project-Id-Version: Omeka\\n&quot;\n&quot;Report-Msgid-Bugs-To: http:\u002F\u002Fgithub.com\u002Fomeka\u002Fplugin-Guest\u002Fissues\\n&quot;\n&quot;POT-Creation-Date: 2012-01-09 21:49-0500\\n&quot;\n&quot;PO-Revision-Date: 2020-04-12 01:18+0000\\n&quot;\n&quot;Last-Translator: billxu &lt;billxu0521@gmail.com&gt;\\n&quot;\n&quot;Language-Team: \\n&quot;\n&quot;MIME-Version: 2.0\\n&quot;\n&quot;Content-Type: text\u002Fplain; charset=UTF-8\\n&quot;\n&quot;Content-Transfer-Encoding: 8bit\\n&quot;\n&quot;Language: zh_TW\\n&quot;\n&quot;Plural-Forms: nplurals=1; plural=0;\\n&quot;\n\nmsgid &quot;Close Menu&quot;  \u002F\u002F這是原始字串原文\nmsgstr &quot;關閉選單&quot;  \u002F\u002F翻譯後\u003C\u002Fcode>\u003C\u002Fpre>\n\u003Cp>再來使用po轉檔成的mo檔 \u003Ca href=\"https:\u002F\u002Fezgif.com\u002Fmo-to-po\" title=\"線上轉換器\">線上轉換器\u003C\u002Fa>\u003C\u002Fp>\n\u003Cp>若開發新模組需要在config\u002Fmodule.config.php中新增下面參數，讓OmekaS能讀到你的語系檔位置\u003C\u002Fp>\n\u003Cpre>\u003Ccode class=\"language-php\">&#039;translator&#039; =&gt; [\n        &#039;translation_file_patterns&#039; =&gt; [\n            [\n                &#039;type&#039; =&gt; &#039;gettext&#039;,\n                &#039;base_dir&#039; =&gt; dirname(__DIR__) . &#039;\u002Flanguage&#039;,\n                &#039;pattern&#039; =&gt; &#039;%s.mo&#039;,\n                &#039;text_domain&#039; =&gt; null,\n            ],\n        ],\n    ],\u003C\u002Fcode>\u003C\u002Fpre>\n\u003Cp>html要導入多國語系設定需要要先宣告\u003C\u002Fp>\n\u003Cpre>\u003Ccode class=\"language-php\">$translate = $this-&gt;plugin(&#039;translate&#039;);\u003C\u002Fcode>\u003C\u002Fpre>\n\u003Cp>接著再對應的位置用這種寫法即可\u003C\u002Fp>\n\u003Cpre>\u003Ccode class=\"language-php\">&lt;?= $translate(&#039;Close Menu&#039;)?&gt;  \u002F\u002F\u002F顯示字串關閉選單\u003C\u002Fcode>\u003C\u002Fpre>\n\u003Cp>在php只要呼叫這樣即可\u003C\u002Fp>\n\u003Cpre>\u003Ccode class=\"language-php\">$translate(&#039;Close Menu&#039;),  \u002F\u002F\u002F顯示字串關閉選單\u003C\u002Fcode>\u003C\u002Fpre>\n","2022-07-10T20:00:36","\u002Fapi\u002Fproxy-image?url=https%3A%2F%2Fpost.billxu.net%2Fwp-content%2Fuploads%2F2022%2F05%2FOmekaBadge.png",{"name":12,"link":13},"Chih Fan","http:\u002F\u002Fpost.billxu.net",[15],{"name":16,"slug":16},"omekas","\u002Fblog\u002Fomekas如何製作多國語系檔案",1]