{"id":254,"date":"2026-09-15T10:26:22","date_gmt":"2026-09-15T02:26:22","guid":{"rendered":"https:\/\/yykcj.com\/?p=254"},"modified":"2026-09-15T10:26:22","modified_gmt":"2026-09-15T02:26:22","slug":"%e5%89%8d%e7%ab%af%e5%9b%bd%e9%99%85%e5%8c%96-i18n-%e6%9c%80%e4%bd%b3%e5%ae%9e%e8%b7%b5%ef%bc%9a%e4%bb%8e%e7%a1%ac%e7%bc%96%e7%a0%81%e5%88%b0%e8%87%aa%e5%8a%a8%e5%8c%96%e5%a4%9a%e8%af%ad%e8%a8%80","status":"publish","type":"post","link":"https:\/\/yykcj.com\/?p=254","title":{"rendered":"\u524d\u7aef\u56fd\u9645\u5316 i18n \u6700\u4f73\u5b9e\u8df5\uff1a\u4ece\u786c\u7f16\u7801\u5230\u81ea\u52a8\u5316\u591a\u8bed\u8a00\u65b9\u6848"},"content":{"rendered":"<h2>\u4e3a\u4ec0\u4e48\u4f60\u7684\u56fd\u9645\u5316\u65b9\u6848\u603b\u662f\u534a\u9014\u800c\u5e9f\uff1f<\/h2>\n<p>\u5f88\u591a\u56e2\u961f\u5728\u9879\u76ee\u521d\u671f\u4e3a\u4e86\u8d76\u8fdb\u5ea6\uff0c\u76f4\u63a5\u628a\u4e2d\u6587\u6587\u6848\u786c\u7f16\u7801\u5728\u7ec4\u4ef6\u91cc\uff0c\u7b49\u5230\u9700\u8981\u652f\u6301\u591a\u8bed\u8a00\u65f6\u624d\u53d1\u73b0\uff1a\u6539\u9020\u6210\u672c\u5de8\u5927\u3001\u7ffb\u8bd1\u6587\u4ef6\u96be\u4ee5\u7ef4\u62a4\u3001\u52a8\u6001\u5185\u5bb9\u65e0\u6cd5\u5904\u7406\u3002\u66f4\u7cdf\u7cd5\u7684\u662f\uff0c\u5373\u4f7f\u5f15\u5165\u4e86 <code>i18next<\/code> \u6216 <code>react-intl<\/code>\uff0c\u4e5f\u5e38\u5e38\u56e0\u4e3a\u914d\u7f6e\u4e0d\u5f53\u5bfc\u81f4\u5305\u4f53\u79ef\u81a8\u80c0\u3001\u5207\u6362\u8bed\u8a00\u65f6\u9875\u9762\u95ea\u70c1\u3002<\/p>\n<p>\u672c\u6587\u5c06\u5e26\u4f60\u4ece\u96f6\u642d\u5efa\u4e00\u5957<strong>\u5de5\u7a0b\u5316\u3001\u53ef\u6269\u5c55\u3001\u9ad8\u6027\u80fd<\/strong>\u7684\u524d\u7aef\u56fd\u9645\u5316\u65b9\u6848\u3002\u6211\u4eec\u4ee5 React + i18next \u4e3a\u4f8b\uff0c\u4f46\u6838\u5fc3\u601d\u60f3\u540c\u6837\u9002\u7528\u4e8e Vue\u3001Svelte \u7b49\u6846\u67b6\u3002<\/p>\n<h2>\u7b2c\u4e00\u6b65\uff1a\u9009\u578b\u4e0e\u57fa\u7840\u914d\u7f6e<\/h2>\n<h3>1.1 \u4e3a\u4ec0\u4e48\u9009\u62e9 i18next\uff1f<\/h3>\n<ul>\n<li><strong>\u751f\u6001\u5b8c\u5584<\/strong>\uff1a\u652f\u6301 React\u3001Vue\u3001Angular \u7b49\u591a\u79cd\u6846\u67b6<\/li>\n<li><strong>\u529f\u80fd\u5f3a\u5927<\/strong>\uff1a\u63d2\u503c\u3001\u590d\u6570\u3001\u4e0a\u4e0b\u6587\u3001\u5d4c\u5957\u7ffb\u8bd1\u4e00\u5e94\u4ff1\u5168<\/li>\n<li><strong>\u52a8\u6001\u52a0\u8f7d<\/strong>\uff1a\u53ef\u6309\u9700\u52a0\u8f7d\u8bed\u8a00\u5305\uff0c\u51cf\u5c11\u9996\u5c4f\u4f53\u79ef<\/li>\n<li><strong>\u793e\u533a\u6d3b\u8dc3<\/strong>\uff1a\u63d2\u4ef6\u4e30\u5bcc\uff0c\u5982\u8bed\u8a00\u68c0\u6d4b\u3001\u540e\u7aef\u52a0\u8f7d\u7b49<\/li>\n<\/ul>\n<h3>1.2 \u6700\u5c0f\u5316\u5b89\u88c5<\/h3>\n<pre><code class=\"language-bash\">\nnpm install i18next react-i18next i18next-browser-languagedetector i18next-http-backend\n<\/code><\/pre>\n<h3>1.3 \u521d\u59cb\u5316\u914d\u7f6e<\/h3>\n<p>\u521b\u5efa <code>src\/i18n.js<\/code>\uff1a<\/p>\n<pre><code class=\"language-javascript\">\nimport i18n from &#x27;i18next&#x27;;\nimport { initReactI18next } from &#x27;react-i18next&#x27;;\nimport LanguageDetector from &#x27;i18next-browser-languagedetector&#x27;;\nimport HttpBackend from &#x27;i18next-http-backend&#x27;;\n\ni18n\n  .use(HttpBackend) \/\/ \u4ece\u670d\u52a1\u5668\u52a0\u8f7d\u7ffb\u8bd1\u6587\u4ef6\n  .use(LanguageDetector) \/\/ \u81ea\u52a8\u68c0\u6d4b\u7528\u6237\u8bed\u8a00\n  .use(initReactI18next)\n  .init({\n    fallbackLng: &#x27;zh-CN&#x27;, \/\/ \u9ed8\u8ba4\u8bed\u8a00\n    debug: process.env.NODE_ENV === &#x27;development&#x27;,\n    interpolation: {\n      escapeValue: false, \/\/ React \u5df2\u7ecf\u5904\u7406\u4e86 XSS\n    },\n    backend: {\n      loadPath: &#x27;\/locales\/{{lng}}\/{{ns}}.json&#x27;, \/\/ \u7ffb\u8bd1\u6587\u4ef6\u8def\u5f84\n    },\n    ns: [&#x27;common&#x27;], \/\/ \u9ed8\u8ba4\u547d\u540d\u7a7a\u95f4\n    defaultNS: &#x27;common&#x27;,\n  });\n\nexport default i18n;\n<\/code><\/pre>\n<p>\u5728 <code>index.js<\/code> \u4e2d\u5f15\u5165\uff1a<\/p>\n<pre><code class=\"language-javascript\">\nimport &#x27;.\/i18n&#x27;;\n<\/code><\/pre>\n<p><strong>\ud83d\udca1 \u6ce8\u610f<\/strong>\uff1a<code>loadPath<\/code> \u4e2d\u7684 <code>{{lng}}<\/code> \u548c <code>{{ns}}<\/code> \u4f1a\u88ab\u81ea\u52a8\u66ff\u6362\u3002\u5efa\u8bae\u5c06\u7ffb\u8bd1\u6587\u4ef6\u653e\u5728 <code>public\/locales<\/code> \u76ee\u5f55\u4e0b\uff0c\u8fd9\u6837\u53ef\u4ee5\u76f4\u63a5\u901a\u8fc7 HTTP \u8bbf\u95ee\u3002<\/p>\n<h2>\u7b2c\u4e8c\u6b65\uff1a\u7ec4\u7ec7\u7ffb\u8bd1\u6587\u4ef6<\/h2>\n<h3>2.1 \u76ee\u5f55\u7ed3\u6784<\/h3>\n<pre><code>\npublic\/\n  locales\/\n    zh-CN\/\n      common.json\n      home.json\n    en-US\/\n      common.json\n      home.json\n<\/code><\/pre>\n<h3>2.2 \u547d\u540d\u7a7a\u95f4\u5212\u5206<\/h3>\n<p>\u6309\u9875\u9762\u6216\u529f\u80fd\u6a21\u5757\u5212\u5206\u547d\u540d\u7a7a\u95f4\uff0c\u907f\u514d\u5355\u4e2a\u6587\u4ef6\u8fc7\u5927\uff1a<\/p>\n<ul>\n<li><code>common.json<\/code>\uff1a\u901a\u7528\u6587\u6848\uff08\u6309\u94ae\u3001\u63d0\u793a\u7b49\uff09<\/li>\n<li><code>home.json<\/code>\uff1a\u9996\u9875\u4e13\u7528<\/li>\n<li><code>user.json<\/code>\uff1a\u7528\u6237\u6a21\u5757<\/li>\n<\/ul>\n<p><strong>\u793a\u4f8b <code>common.json<\/code><\/strong>\uff1a<\/p>\n<pre><code class=\"language-json\">\n{\n  &quot;welcome&quot;: &quot;\u6b22\u8fce\u56de\u6765\uff0c{{name}}\uff01&quot;,\n  &quot;button&quot;: {\n    &quot;submit&quot;: &quot;\u63d0\u4ea4&quot;,\n    &quot;cancel&quot;: &quot;\u53d6\u6d88&quot;\n  },\n  &quot;items&quot;: &quot;{{count}} \u4ef6\u5546\u54c1&quot;,\n  &quot;items_plural&quot;: &quot;{{count}} \u4ef6\u5546\u54c1&quot;\n}\n<\/code><\/pre>\n<p><strong>\ud83d\udca1 \u6ce8\u610f<\/strong>\uff1a\u590d\u6570\u5f62\u5f0f\u5728\u82f1\u6587\u4e2d\u9700\u8981\u533a\u5206 <code>_plural<\/code>\uff0c\u4e2d\u6587\u867d\u7136\u4e0d\u9700\u8981\uff0c\u4f46\u4e3a\u4e86\u7edf\u4e00\u683c\u5f0f\uff0c\u5efa\u8bae\u4fdd\u7559\u3002<\/p>\n<h2>\u7b2c\u4e09\u6b65\uff1a\u5728\u7ec4\u4ef6\u4e2d\u4f7f\u7528<\/h2>\n<h3>3.1 \u57fa\u672c\u7528\u6cd5<\/h3>\n<pre><code class=\"language-jsx\">\nimport { useTranslation } from &#x27;react-i18next&#x27;;\n\nfunction App() {\n  const { t, i18n } = useTranslation();\n\n  const changeLanguage = (lng) =&gt; {\n    i18n.changeLanguage(lng);\n  };\n\n  return (\n    &lt;div&gt;\n      &lt;h1&gt;{t(&#x27;welcome&#x27;, { name: &#x27;\u5f20\u4e09&#x27; })}&lt;\/h1&gt;\n      &lt;button onClick={() =&gt; changeLanguage(&#x27;en-US&#x27;)}&gt;English&lt;\/button&gt;\n      &lt;button onClick={() =&gt; changeLanguage(&#x27;zh-CN&#x27;)}&gt;\u4e2d\u6587&lt;\/button&gt;\n    &lt;\/div&gt;\n  );\n}\n<\/code><\/pre>\n<h3>3.2 \u5904\u7406\u590d\u6570<\/h3>\n<pre><code class=\"language-jsx\">\n\/\/ \u6839\u636e count \u81ea\u52a8\u9009\u62e9\u5355\u590d\u6570\n&lt;p&gt;{t(&#x27;items&#x27;, { count: 3 })}&lt;\/p&gt;\n<\/code><\/pre>\n<p>\u5bf9\u4e8e\u82f1\u6587\uff0c<code>common.json<\/code> \u9700\u8981\u8fd9\u6837\u5199\uff1a<\/p>\n<pre><code class=\"language-json\">\n{\n  &quot;items&quot;: &quot;{{count}} item&quot;,\n  &quot;items_plural&quot;: &quot;{{count}} items&quot;\n}\n<\/code><\/pre>\n<h3>3.3 \u52a8\u6001\u52a0\u8f7d\u547d\u540d\u7a7a\u95f4<\/h3>\n<p>\u5982\u679c\u67d0\u4e2a\u9875\u9762\u53ea\u5728\u7279\u5b9a\u8def\u7531\u4e0b\u4f7f\u7528\uff0c\u53ef\u4ee5\u6309\u9700\u52a0\u8f7d\uff1a<\/p>\n<pre><code class=\"language-jsx\">\nconst { t } = useTranslation(&#x27;home&#x27;); \/\/ \u52a0\u8f7d home \u547d\u540d\u7a7a\u95f4\n<\/code><\/pre>\n<p>\u6216\u8005\u5728\u7ec4\u4ef6\u6302\u8f7d\u65f6\u52a0\u8f7d\uff1a<\/p>\n<pre><code class=\"language-jsx\">\nimport { useEffect } from &#x27;react&#x27;;\nimport { useTranslation } from &#x27;react-i18next&#x27;;\n\nfunction Home() {\n  const { t, i18n } = useTranslation();\n\n  useEffect(() =&gt; {\n    i18n.loadNamespaces(&#x27;home&#x27;);\n  }, [i18n]);\n\n  return &lt;h2&gt;{t(&#x27;home:title&#x27;)}&lt;\/h2&gt;;\n}\n<\/code><\/pre>\n<h2>\u7b2c\u56db\u6b65\uff1a\u9ad8\u7ea7\u6280\u5de7\u4e0e\u6700\u4f73\u5b9e\u8df5<\/h2>\n<h3>4.1 \u63d0\u53d6\u786c\u7f16\u7801\u6587\u6848<\/h3>\n<p>\u624b\u52a8\u63d0\u53d6\u5bb9\u6613\u9057\u6f0f\uff0c\u63a8\u8350\u4f7f\u7528 <code>i18next-parser<\/code> \u81ea\u52a8\u626b\u63cf\u4ee3\u7801\u4e2d\u7684 <code>t()<\/code> \u8c03\u7528\uff0c\u751f\u6210\u7ffb\u8bd1\u6587\u4ef6\u3002<\/p>\n<pre><code class=\"language-bash\">\nnpm install i18next-parser --save-dev\n<\/code><\/pre>\n<p>\u914d\u7f6e <code>i18next-parser.config.js<\/code>\uff1a<\/p>\n<pre><code class=\"language-javascript\">\nmodule.exports = {\n  locales: [&#x27;zh-CN&#x27;, &#x27;en-US&#x27;],\n  output: &#x27;public\/locales\/$LOCALE\/$NAMESPACE.json&#x27;,\n  input: [&#x27;src\/**\/*.{js,jsx,ts,tsx}&#x27;],\n  sort: true,\n  createOldCatalogs: false,\n};\n<\/code><\/pre>\n<p>\u5728 <code>package.json<\/code> \u4e2d\u6dfb\u52a0\u811a\u672c\uff1a<\/p>\n<pre><code class=\"language-json\">\n{\n  &quot;scripts&quot;: {\n    &quot;i18n:extract&quot;: &quot;i18next-parser&quot;\n  }\n}\n<\/code><\/pre>\n<p>\u8fd0\u884c <code>npm run i18n:extract<\/code>\uff0c\u5b83\u4f1a\u81ea\u52a8\u66f4\u65b0\u7ffb\u8bd1\u6587\u4ef6\uff0c\u4fdd\u7559\u5df2\u6709\u7ffb\u8bd1\u5e76\u6dfb\u52a0\u65b0 key\u3002<\/p>\n<h3>4.2 \u5904\u7406\u65e5\u671f\u3001\u65f6\u95f4\u548c\u8d27\u5e01<\/h3>\n<p>\u4f7f\u7528 <code>Intl<\/code> API \u914d\u5408 i18next \u7684\u683c\u5f0f\u5316\u529f\u80fd\uff1a<\/p>\n<pre><code class=\"language-javascript\">\n\/\/ \u5728 i18n.js \u4e2d\u914d\u7f6e\ninterpolation: {\n  format: (value, format, lng) =&gt; {\n    if (format === &#x27;datetime&#x27;) {\n      return new Intl.DateTimeFormat(lng).format(value);\n    }\n    if (format === &#x27;currency&#x27;) {\n      return new Intl.NumberFormat(lng, { style: &#x27;currency&#x27;, currency: &#x27;USD&#x27; }).format(value);\n    }\n    return value;\n  },\n},\n<\/code><\/pre>\n<p>\u7ec4\u4ef6\u4e2d\u4f7f\u7528\uff1a<\/p>\n<pre><code class=\"language-jsx\">\n&lt;p&gt;{t(&#x27;orderDate&#x27;, { date: new Date(), format: &#x27;datetime&#x27; })}&lt;\/p&gt;\n<\/code><\/pre>\n<p>\u7ffb\u8bd1\u6587\u4ef6\uff1a<\/p>\n<pre><code class=\"language-json\">\n{\n  &quot;orderDate&quot;: &quot;\u8ba2\u5355\u65e5\u671f\uff1a{{date, datetime}}&quot;\n}\n<\/code><\/pre>\n<h3>4.3 \u907f\u514d\u8bed\u8a00\u5207\u6362\u95ea\u70c1<\/h3>\n<p>\u5207\u6362\u8bed\u8a00\u65f6\uff0c\u5982\u679c\u7ffb\u8bd1\u6587\u4ef6\u672a\u52a0\u8f7d\u5b8c\u6210\uff0c\u9875\u9762\u4f1a\u663e\u793a key \u800c\u4e0d\u662f\u6587\u6848\u3002\u89e3\u51b3\u65b9\u6848\uff1a<\/p>\n<ol>\n<li><strong>\u9884\u52a0\u8f7d\u6240\u6709\u8bed\u8a00\u5305<\/strong>\uff08\u9002\u5408\u5c0f\u9879\u76ee\uff09\uff1a<\/li>\n<\/ol>\n<pre><code class=\"language-javascript\">\nbackend: {\n  loadPath: &#x27;\/locales\/{{lng}}\/{{ns}}.json&#x27;,\n  \/\/ \u9884\u52a0\u8f7d\n  allowMultiLoading: false,\n},\n<\/code><\/pre>\n<ol>\n<li><strong>\u4f7f\u7528 Suspense \u5305\u88f9<\/strong>\uff08React\uff09\uff1a<\/li>\n<\/ol>\n<pre><code class=\"language-jsx\">\nimport { Suspense } from &#x27;react&#x27;;\n\n&lt;Suspense fallback={&lt;div&gt;Loading...&lt;\/div&gt;}&gt;\n  &lt;App \/&gt;\n&lt;\/Suspense&gt;\n<\/code><\/pre>\n<ol>\n<li><strong>\u5728\u5207\u6362\u8bed\u8a00\u524d\u52a0\u8f7d\u8d44\u6e90<\/strong>\uff1a<\/li>\n<\/ol>\n<pre><code class=\"language-javascript\">\nconst changeLanguage = async (lng) =&gt; {\n  await i18n.loadLanguages(lng);\n  i18n.changeLanguage(lng);\n};\n<\/code><\/pre>\n<h3>4.4 \u5904\u7406\u5e26 HTML \u7684\u7ffb\u8bd1<\/h3>\n<p>\u6709\u65f6\u7ffb\u8bd1\u9700\u8981\u5305\u542b\u94fe\u63a5\u6216\u52a0\u7c97\u6587\u672c\uff0c\u4f7f\u7528 <code><Trans><\/code> \u7ec4\u4ef6\uff1a<\/p>\n<pre><code class=\"language-jsx\">\nimport { Trans } from &#x27;react-i18next&#x27;;\n\n&lt;Trans i18nKey=&quot;terms&quot;&gt;\n  \u8bf7\u9605\u8bfb &lt;a href=&quot;\/terms&quot;&gt;\u670d\u52a1\u6761\u6b3e&lt;\/a&gt;\n&lt;\/Trans&gt;\n<\/code><\/pre>\n<p>\u7ffb\u8bd1\u6587\u4ef6\uff1a<\/p>\n<pre><code class=\"language-json\">\n{\n  &quot;terms&quot;: &quot;\u8bf7\u9605\u8bfb &lt;1&gt;\u670d\u52a1\u6761\u6b3e&lt;\/1&gt;&quot;\n}\n<\/code><\/pre>\n<p><strong>\ud83d\udca1 \u6ce8\u610f<\/strong>\uff1a<code><1><\/code> \u5bf9\u5e94\u5b50\u5143\u7d20\u7d22\u5f15\uff0c\u4ece 0 \u5f00\u59cb\u3002<\/p>\n<h2>\u7b2c\u4e94\u6b65\uff1a\u5de5\u7a0b\u5316\u4e0e\u56e2\u961f\u534f\u4f5c<\/h2>\n<h3>5.1 \u7ffb\u8bd1\u952e\u547d\u540d\u89c4\u8303<\/h3>\n<ul>\n<li>\u4f7f\u7528\u5c0f\u9a7c\u5cf0\uff1a<code>userProfile.title<\/code><\/li>\n<li>\u6309\u6a21\u5757\u524d\u7f00\uff1a<code>home.hero.title<\/code><\/li>\n<li>\u907f\u514d\u65e0\u610f\u4e49\u7684 key\uff1a<code>text1<\/code>\u3001<code>label2<\/code><\/li>\n<\/ul>\n<h3>5.2 \u4e0e\u7ffb\u8bd1\u5e73\u53f0\u96c6\u6210<\/h3>\n<p>\u63a8\u8350\u4f7f\u7528 <a href=\"https:\/\/locize.com\/\">Locize<\/a> \u6216 <a href=\"https:\/\/crowdin.com\/\">Crowdin<\/a> \u7ba1\u7406\u7ffb\u8bd1\u6d41\u7a0b\u3002\u901a\u8fc7 CLI \u5de5\u5177\u540c\u6b65\u7ffb\u8bd1\u6587\u4ef6\uff1a<\/p>\n<pre><code class=\"language-bash\">\nnpm install locize-cli --save-dev\nnpx locize sync --project-id YOUR_PROJECT_ID --api-key YOUR_API_KEY\n<\/code><\/pre>\n<h3>5.3 \u6d4b\u8bd5\u4e0e\u6821\u9a8c<\/h3>\n<ul>\n<li><strong>\u5355\u5143\u6d4b\u8bd5<\/strong>\uff1a\u786e\u4fdd\u6240\u6709 key \u90fd\u6709\u5bf9\u5e94\u7ffb\u8bd1<\/li>\n<li><strong>E2E \u6d4b\u8bd5<\/strong>\uff1a\u5207\u6362\u8bed\u8a00\u540e\u68c0\u67e5\u5173\u952e\u6587\u6848<\/li>\n<li><strong>CI \u68c0\u67e5<\/strong>\uff1a\u5728\u6d41\u6c34\u7ebf\u4e2d\u8fd0\u884c <code>i18next-parser<\/code> \u5e76\u68c0\u67e5\u662f\u5426\u6709\u672a\u7ffb\u8bd1\u7684 key<\/li>\n<\/ul>\n<pre><code class=\"language-javascript\">\n\/\/ \u7b80\u5355\u7684 key \u6821\u9a8c\u811a\u672c\nconst fs = require(&#x27;fs&#x27;);\nconst path = require(&#x27;path&#x27;);\n\nconst locales = [&#x27;zh-CN&#x27;, &#x27;en-US&#x27;];\nconst basePath = path.join(__dirname, &#x27;public\/locales&#x27;);\n\nlocales.forEach((lng) =&gt; {\n  const files = fs.readdirSync(path.join(basePath, lng));\n  files.forEach((file) =&gt; {\n    const content = JSON.parse(fs.readFileSync(path.join(basePath, lng, file)));\n    \/\/ \u68c0\u67e5\u662f\u5426\u6709\u7a7a\u503c\n    Object.entries(content).forEach(([key, value]) =&gt; {\n      if (!value) console.warn(`[${lng}] ${file} \u4e2d\u7684 ${key} \u4e3a\u7a7a`);\n    });\n  });\n});\n<\/code><\/pre>\n<h2>\u5e38\u89c1\u5751\u4e0e\u89e3\u51b3\u65b9\u6848<\/h2>\n<ol>\n<li><strong>key \u51b2\u7a81<\/strong>\uff1a\u4e0d\u540c\u547d\u540d\u7a7a\u95f4\u4f7f\u7528\u76f8\u540c key\uff0c\u901a\u8fc7 <code>ns:key<\/code> \u660e\u786e\u6307\u5b9a\u3002<\/li>\n<li><strong>\u52a8\u6001 key<\/strong>\uff1a\u907f\u514d\u4f7f\u7528 <code>t(variable)<\/code>\uff0c\u8fd9\u4f1a\u5bfc\u81f4\u65e0\u6cd5\u9759\u6001\u63d0\u53d6\uff0c\u5efa\u8bae\u7528\u6620\u5c04\u8868\u3002<\/li>\n<li><strong>\u6027\u80fd\u95ee\u9898<\/strong>\uff1a\u8bed\u8a00\u5305\u8fc7\u5927\u65f6\uff0c\u4f7f\u7528 <code>i18next-http-backend<\/code> \u6309\u9700\u52a0\u8f7d\uff0c\u5e76\u5f00\u542f HTTP \u7f13\u5b58\u3002<\/li>\n<li><strong>SEO \u53cb\u597d<\/strong>\uff1a\u670d\u52a1\u7aef\u6e32\u67d3\u65f6\uff0c\u786e\u4fdd\u8bed\u8a00\u5305\u5728\u670d\u52a1\u7aef\u52a0\u8f7d\uff0c\u907f\u514d\u95ea\u70c1\u3002<\/li>\n<\/ol>\n<h2>\u603b\u7ed3<\/h2>\n<p>\u524d\u7aef\u56fd\u9645\u5316\u4e0d\u662f\u7b80\u5355\u7684\u66ff\u6362\u6587\u6848\uff0c\u800c\u662f\u4e00\u5957\u9700\u8981\u4ece\u9879\u76ee\u521d\u671f\u5c31\u89c4\u5212\u597d\u7684\u5de5\u7a0b\u4f53\u7cfb\u3002\u672c\u6587\u4ecb\u7ecd\u7684\u65b9\u6848\u5df2\u5728\u591a\u4e2a\u4e2d\u5927\u578b\u9879\u76ee\u4e2d\u9a8c\u8bc1\uff0c\u6838\u5fc3\u8981\u70b9\uff1a<\/p>\n<ul>\n<li>\u4f7f\u7528\u547d\u540d\u7a7a\u95f4\u548c\u6309\u9700\u52a0\u8f7d\u4f18\u5316\u6027\u80fd<\/li>\n<li>\u901a\u8fc7\u81ea\u52a8\u5316\u5de5\u5177\u63d0\u53d6\u548c\u6821\u9a8c\u7ffb\u8bd1<\/li>\n<li>\u5229\u7528 <code>Intl<\/code> \u5904\u7406\u65e5\u671f\u3001\u8d27\u5e01\u7b49\u672c\u5730\u5316\u683c\u5f0f<\/li>\n<li>\u5efa\u7acb\u56e2\u961f\u534f\u4f5c\u89c4\u8303\uff0c\u4e0e\u7ffb\u8bd1\u5e73\u53f0\u96c6\u6210<\/li>\n<\/ul>\n<p>\u4e0b\u4e00\u6b65\uff0c\u4f60\u53ef\u4ee5\u63a2\u7d22\uff1a<\/p>\n<ul>\n<li>\u670d\u52a1\u7aef\u6e32\u67d3\uff08SSR\uff09\u4e0b\u7684\u56fd\u9645\u5316\u65b9\u6848<\/li>\n<li>\u4f7f\u7528 <code>i18next-icu<\/code> \u652f\u6301\u66f4\u590d\u6742\u7684 ICU \u6d88\u606f\u683c\u5f0f<\/li>\n<li>\u57fa\u4e8e\u7528\u6237\u504f\u597d\u52a8\u6001\u5207\u6362\u8bed\u8a00<\/li>\n<\/ul>\n<p>\u5e0c\u671b\u8fd9\u7bc7\u6587\u7ae0\u80fd\u5e2e\u52a9\u4f60\u6253\u9020\u4e00\u4e2a\u4f18\u96c5\u3001\u53ef\u7ef4\u62a4\u7684\u56fd\u9645\u5316\u65b9\u6848\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u672c\u6587\u5206\u4eab\u4e00\u5957\u7ecf\u8fc7\u5927\u578b\u9879\u76ee\u9a8c\u8bc1\u7684\u524d\u7aef\u56fd\u9645\u5316\u65b9\u6848\uff0c\u6db5\u76d6\u6587\u6848\u63d0\u53d6\u3001\u52a8\u6001\u52a0\u8f7d\u3001\u590d\u6570\u5904\u7406\u3001\u65e5\u671f\u683c\u5f0f\u5316\u7b49\u6838\u5fc3\u73af\u8282\uff0c\u5e76\u7ed9\u51fa\u53ef\u590d\u7528\u7684\u5de5\u7a0b\u5316\u914d\u7f6e\uff0c\u5e2e\u52a9\u4f60\u5f7b\u5e95\u544a\u522b\u786c\u7f16\u7801\u6587\u6848\u7684\u70e6\u607c\u3002<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3,4],"tags":[77,79,11,167,78],"class_list":["post-254","post","type-post","status-publish","format-standard","hentry","category-3","category-4","tag-i18n","tag-i18next","tag-react","tag-167","tag-78"],"_links":{"self":[{"href":"https:\/\/yykcj.com\/index.php?rest_route=\/wp\/v2\/posts\/254","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/yykcj.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/yykcj.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/yykcj.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/yykcj.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=254"}],"version-history":[{"count":0,"href":"https:\/\/yykcj.com\/index.php?rest_route=\/wp\/v2\/posts\/254\/revisions"}],"wp:attachment":[{"href":"https:\/\/yykcj.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=254"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/yykcj.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=254"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/yykcj.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=254"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}