@docusaurus/theme-translations 2.0.0-beta.11 → 2.0.0-beta.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. package/lib/index.d.ts +13 -0
  2. package/lib/index.d.ts.map +1 -0
  3. package/lib/index.js +9 -9
  4. package/lib/index.js.map +1 -0
  5. package/locales/ar/plugin-ideal-image.json +7 -0
  6. package/locales/base/plugin-ideal-image.json +12 -0
  7. package/locales/bn/plugin-ideal-image.json +7 -0
  8. package/locales/cs/plugin-ideal-image.json +7 -0
  9. package/locales/da/plugin-ideal-image.json +7 -0
  10. package/locales/de/plugin-ideal-image.json +7 -0
  11. package/locales/es/plugin-ideal-image.json +7 -0
  12. package/locales/fa/plugin-ideal-image.json +7 -0
  13. package/locales/fil/plugin-ideal-image.json +7 -0
  14. package/locales/fr/plugin-ideal-image.json +7 -0
  15. package/locales/he/plugin-ideal-image.json +7 -0
  16. package/locales/hi/plugin-ideal-image.json +7 -0
  17. package/locales/it/plugin-ideal-image.json +7 -0
  18. package/locales/it/plugin-pwa.json +5 -0
  19. package/locales/it/theme-common.json +51 -0
  20. package/locales/it/theme-live-codeblock.json +4 -0
  21. package/locales/it/theme-search-algolia.json +11 -0
  22. package/locales/ja/plugin-ideal-image.json +7 -0
  23. package/locales/ko/plugin-ideal-image.json +7 -0
  24. package/locales/pl/plugin-ideal-image.json +7 -0
  25. package/locales/pt-BR/plugin-ideal-image.json +7 -0
  26. package/locales/pt-PT/plugin-ideal-image.json +7 -0
  27. package/locales/ru/plugin-ideal-image.json +7 -0
  28. package/locales/sr/plugin-ideal-image.json +7 -0
  29. package/locales/tr/plugin-ideal-image.json +7 -0
  30. package/locales/vi/plugin-ideal-image.json +7 -0
  31. package/locales/zh-Hans/plugin-ideal-image.json +7 -0
  32. package/locales/zh-Hant/plugin-ideal-image.json +7 -0
  33. package/package.json +5 -7
  34. package/src/index.ts +60 -0
package/lib/index.d.ts ADDED
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Copyright (c) Facebook, Inc. and its affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+ export declare function codeTranslationLocalesToTry(locale: string): string[];
8
+ export declare function readDefaultCodeTranslationMessages({ dirPath, locale, name, }: {
9
+ dirPath?: string;
10
+ locale: string;
11
+ name: string;
12
+ }): Promise<Record<string, string>>;
13
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAUH,wBAAgB,2BAA2B,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAiBpE;AAGD,wBAAsB,kCAAkC,CAAC,EACvD,OAAoC,EACpC,MAAM,EACN,IAAI,GACL,EAAE;IACD,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;CACd,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAgBlC"}
package/lib/index.js CHANGED
@@ -11,22 +11,21 @@ const tslib_1 = require("tslib");
11
11
  const path_1 = (0, tslib_1.__importDefault)(require("path"));
12
12
  const fs_extra_1 = (0, tslib_1.__importDefault)(require("fs-extra"));
13
13
  function getDefaultLocalesDirPath() {
14
- const parentDirPath = path_1.default.join(__dirname, '..');
15
- const pkg = JSON.parse(fs_extra_1.default.readFileSync(path_1.default.join(parentDirPath, 'package.json'), 'utf8'));
16
- return path_1.default.join(parentDirPath, pkg.files[0]);
14
+ return path_1.default.join(__dirname, '../locales');
17
15
  }
18
16
  // Return an ordered list of locales we should try
19
17
  function codeTranslationLocalesToTry(locale) {
20
- const intlLocale = Intl.Locale ? new Intl.Locale(locale) : undefined;
21
- if (!intlLocale) {
22
- return [locale];
23
- }
18
+ const intlLocale = new Intl.Locale(locale);
24
19
  // if locale is just a simple language like "pt", we want to fallback to pt-BR (not pt-PT!)
25
20
  // see https://github.com/facebook/docusaurus/pull/4536#issuecomment-810088783
26
21
  if (intlLocale.language === locale) {
27
22
  const maximizedLocale = intlLocale.maximize(); // pt-Latn-BR`
28
- // ["pt","pt-BR"]
29
- return [locale, `${maximizedLocale.language}-${maximizedLocale.region}`];
23
+ // ["pt","pt-BR"]; ["zh", "zh-Hans"]
24
+ return [
25
+ locale,
26
+ `${maximizedLocale.language}-${maximizedLocale.region}`,
27
+ `${maximizedLocale.language}-${maximizedLocale.script}`,
28
+ ];
30
29
  }
31
30
  // if locale is like "pt-BR", we want to fallback to "pt"
32
31
  else {
@@ -50,3 +49,4 @@ async function readDefaultCodeTranslationMessages({ dirPath = getDefaultLocalesD
50
49
  return {};
51
50
  }
52
51
  exports.readDefaultCodeTranslationMessages = readDefaultCodeTranslationMessages;
52
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;;AAEH,6DAAwB;AACxB,qEAA0B;AAE1B,SAAS,wBAAwB;IAC/B,OAAO,cAAI,CAAC,IAAI,CAAC,SAAS,EAAE,YAAY,CAAC,CAAC;AAC5C,CAAC;AAED,kDAAkD;AAClD,SAAgB,2BAA2B,CAAC,MAAc;IACxD,MAAM,UAAU,GAAG,IAAI,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IAC3C,2FAA2F;IAC3F,8EAA8E;IAC9E,IAAI,UAAU,CAAC,QAAQ,KAAK,MAAM,EAAE;QAClC,MAAM,eAAe,GAAG,UAAU,CAAC,QAAQ,EAAE,CAAC,CAAC,cAAc;QAC7D,oCAAoC;QACpC,OAAO;YACL,MAAM;YACN,GAAG,eAAe,CAAC,QAAQ,IAAI,eAAe,CAAC,MAAM,EAAE;YACvD,GAAG,eAAe,CAAC,QAAQ,IAAI,eAAe,CAAC,MAAM,EAAE;SACxD,CAAC;KACH;IACD,yDAAyD;SACpD;QACH,OAAO,CAAC,MAAM,EAAE,UAAU,CAAC,QAAS,CAAC,CAAC;KACvC;AACH,CAAC;AAjBD,kEAiBC;AAED,oEAAoE;AAC7D,KAAK,UAAU,kCAAkC,CAAC,EACvD,OAAO,GAAG,wBAAwB,EAAE,EACpC,MAAM,EACN,IAAI,GAKL;IACC,MAAM,YAAY,GAAG,2BAA2B,CAAC,MAAM,CAAC,CAAC;IAEzD,kDAAkD;IAClD,mCAAmC;IACnC,gDAAgD;IAChD,KAAK,MAAM,WAAW,IAAI,YAAY,EAAE;QACtC,MAAM,QAAQ,GAAG,cAAI,CAAC,OAAO,CAAC,OAAO,EAAE,WAAW,EAAE,GAAG,IAAI,OAAO,CAAC,CAAC;QAEpE,IAAI,MAAM,kBAAE,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAE;YACjC,MAAM,WAAW,GAAG,MAAM,kBAAE,CAAC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;YACxD,OAAO,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;SAChC;KACF;IAED,OAAO,EAAE,CAAC;AACZ,CAAC;AAxBD,gFAwBC"}
@@ -0,0 +1,7 @@
1
+ {
2
+ "theme.IdealImageMessage.404error": "404. Image not found",
3
+ "theme.IdealImageMessage.error": "Error. Click to reload",
4
+ "theme.IdealImageMessage.load": "Click to load{sizeMessage}",
5
+ "theme.IdealImageMessage.loading": "Loading...",
6
+ "theme.IdealImageMessage.offline": "Your browser is offline. Image not loaded"
7
+ }
@@ -0,0 +1,12 @@
1
+ {
2
+ "theme.IdealImageMessage.404error": "404. Image not found",
3
+ "theme.IdealImageMessage.404error___DESCRIPTION": "When the image is not found",
4
+ "theme.IdealImageMessage.error": "Error. Click to reload",
5
+ "theme.IdealImageMessage.error___DESCRIPTION": "When the image fails to load for unknown error",
6
+ "theme.IdealImageMessage.load": "Click to load{sizeMessage}",
7
+ "theme.IdealImageMessage.load___DESCRIPTION": "To prompt users to load the full image. sizeMessage is a parenthesized size figure.",
8
+ "theme.IdealImageMessage.loading": "Loading...",
9
+ "theme.IdealImageMessage.loading___DESCRIPTION": "When the full-scale image is loading",
10
+ "theme.IdealImageMessage.offline": "Your browser is offline. Image not loaded",
11
+ "theme.IdealImageMessage.offline___DESCRIPTION": "When the user is viewing an offline document"
12
+ }
@@ -0,0 +1,7 @@
1
+ {
2
+ "theme.IdealImageMessage.404error": "404. Image not found",
3
+ "theme.IdealImageMessage.error": "Error. Click to reload",
4
+ "theme.IdealImageMessage.load": "Click to load{sizeMessage}",
5
+ "theme.IdealImageMessage.loading": "Loading...",
6
+ "theme.IdealImageMessage.offline": "Your browser is offline. Image not loaded"
7
+ }
@@ -0,0 +1,7 @@
1
+ {
2
+ "theme.IdealImageMessage.404error": "404. Image not found",
3
+ "theme.IdealImageMessage.error": "Error. Click to reload",
4
+ "theme.IdealImageMessage.load": "Click to load{sizeMessage}",
5
+ "theme.IdealImageMessage.loading": "Loading...",
6
+ "theme.IdealImageMessage.offline": "Your browser is offline. Image not loaded"
7
+ }
@@ -0,0 +1,7 @@
1
+ {
2
+ "theme.IdealImageMessage.404error": "404. Image not found",
3
+ "theme.IdealImageMessage.error": "Error. Click to reload",
4
+ "theme.IdealImageMessage.load": "Click to load{sizeMessage}",
5
+ "theme.IdealImageMessage.loading": "Loading...",
6
+ "theme.IdealImageMessage.offline": "Your browser is offline. Image not loaded"
7
+ }
@@ -0,0 +1,7 @@
1
+ {
2
+ "theme.IdealImageMessage.404error": "404. Image not found",
3
+ "theme.IdealImageMessage.error": "Error. Click to reload",
4
+ "theme.IdealImageMessage.load": "Click to load{sizeMessage}",
5
+ "theme.IdealImageMessage.loading": "Loading...",
6
+ "theme.IdealImageMessage.offline": "Your browser is offline. Image not loaded"
7
+ }
@@ -0,0 +1,7 @@
1
+ {
2
+ "theme.IdealImageMessage.404error": "404. Image not found",
3
+ "theme.IdealImageMessage.error": "Error. Click to reload",
4
+ "theme.IdealImageMessage.load": "Click to load{sizeMessage}",
5
+ "theme.IdealImageMessage.loading": "Loading...",
6
+ "theme.IdealImageMessage.offline": "Your browser is offline. Image not loaded"
7
+ }
@@ -0,0 +1,7 @@
1
+ {
2
+ "theme.IdealImageMessage.404error": "404. Image not found",
3
+ "theme.IdealImageMessage.error": "Error. Click to reload",
4
+ "theme.IdealImageMessage.load": "Click to load{sizeMessage}",
5
+ "theme.IdealImageMessage.loading": "Loading...",
6
+ "theme.IdealImageMessage.offline": "Your browser is offline. Image not loaded"
7
+ }
@@ -0,0 +1,7 @@
1
+ {
2
+ "theme.IdealImageMessage.404error": "404. Image not found",
3
+ "theme.IdealImageMessage.error": "Error. Click to reload",
4
+ "theme.IdealImageMessage.load": "Click to load{sizeMessage}",
5
+ "theme.IdealImageMessage.loading": "Loading...",
6
+ "theme.IdealImageMessage.offline": "Your browser is offline. Image not loaded"
7
+ }
@@ -0,0 +1,7 @@
1
+ {
2
+ "theme.IdealImageMessage.404error": "404. Image not found",
3
+ "theme.IdealImageMessage.error": "Error. Click to reload",
4
+ "theme.IdealImageMessage.load": "Click to load{sizeMessage}",
5
+ "theme.IdealImageMessage.loading": "Loading...",
6
+ "theme.IdealImageMessage.offline": "Your browser is offline. Image not loaded"
7
+ }
@@ -0,0 +1,7 @@
1
+ {
2
+ "theme.IdealImageMessage.404error": "404. Image not found",
3
+ "theme.IdealImageMessage.error": "Error. Click to reload",
4
+ "theme.IdealImageMessage.load": "Click to load{sizeMessage}",
5
+ "theme.IdealImageMessage.loading": "Loading...",
6
+ "theme.IdealImageMessage.offline": "Your browser is offline. Image not loaded"
7
+ }
@@ -0,0 +1,7 @@
1
+ {
2
+ "theme.IdealImageMessage.404error": "404. Image not found",
3
+ "theme.IdealImageMessage.error": "Error. Click to reload",
4
+ "theme.IdealImageMessage.load": "Click to load{sizeMessage}",
5
+ "theme.IdealImageMessage.loading": "Loading...",
6
+ "theme.IdealImageMessage.offline": "Your browser is offline. Image not loaded"
7
+ }
@@ -0,0 +1,7 @@
1
+ {
2
+ "theme.IdealImageMessage.404error": "404. Image not found",
3
+ "theme.IdealImageMessage.error": "Error. Click to reload",
4
+ "theme.IdealImageMessage.load": "Click to load{sizeMessage}",
5
+ "theme.IdealImageMessage.loading": "Loading...",
6
+ "theme.IdealImageMessage.offline": "Your browser is offline. Image not loaded"
7
+ }
@@ -0,0 +1,5 @@
1
+ {
2
+ "theme.PwaReloadPopup.closeButtonAriaLabel": "Chiudi",
3
+ "theme.PwaReloadPopup.info": "Nuova versione disponibile",
4
+ "theme.PwaReloadPopup.refreshButtonText": "Aggiorna"
5
+ }
@@ -0,0 +1,51 @@
1
+ {
2
+ "theme.AnnouncementBar.closeButtonAriaLabel": "Chiudi",
3
+ "theme.BackToTopButton.buttonAriaLabel": "Torna indietro all'inizio",
4
+ "theme.CodeBlock.copied": "Copiato",
5
+ "theme.CodeBlock.copy": "Copia",
6
+ "theme.CodeBlock.copyButtonAriaLabel": "Copia il codice negli appunti",
7
+ "theme.DocSidebarItem.toggleCollapsedCategoryAriaLabel": "Attiva/disattiva la categoria '{label}' della barra laterale collassabile",
8
+ "theme.ErrorPageContent.title": "Questa pagina è andata in crash.",
9
+ "theme.ErrorPageContent.tryAgain": "Prova di nuovo",
10
+ "theme.NotFound.p1": "Non siamo riusciti a trovare quello che stavi cercando.",
11
+ "theme.NotFound.p2": "Contatta il proprietario del sito che ti ha collegato all'URL originale e fagli sapere che il loro collegamento è interrotto.",
12
+ "theme.NotFound.title": "Pagina non trovata",
13
+ "theme.TOCCollapsible.toggleButtonLabel": "Su questa pagina",
14
+ "theme.blog.archive.description": "Archivio",
15
+ "theme.blog.archive.title": "Archivio",
16
+ "theme.blog.paginator.navAriaLabel": "Navigazione nella pagina dei post del blog ",
17
+ "theme.blog.paginator.newerEntries": "Post più recenti",
18
+ "theme.blog.paginator.olderEntries": "Post più vecchi",
19
+ "theme.blog.post.paginator.navAriaLabel": "Navigazione nella pagina dei post del blog ",
20
+ "theme.blog.post.paginator.newerPost": "Post più recente",
21
+ "theme.blog.post.paginator.olderPost": "Post più vecchio",
22
+ "theme.blog.post.plurals": "Un post|{count} post",
23
+ "theme.blog.post.readMore": "Leggi di più",
24
+ "theme.blog.post.readingTime.plurals": "Lettura di 1 minuto|{readingTime} minuti di lettura",
25
+ "theme.blog.sidebar.navAriaLabel": "Navigazione dei post recenti del blog",
26
+ "theme.blog.tagTitle": "{nPosts} etichettati con \"{tagName}\"",
27
+ "theme.common.editThisPage": "Modifica questa pagina",
28
+ "theme.common.headingLinkTitle": "Link diretto all'intestazione",
29
+ "theme.common.skipToMainContent": "Passa al contenuto principale",
30
+ "theme.docs.paginator.navAriaLabel": "Navigazione delle pagine dei documenti",
31
+ "theme.docs.paginator.next": "Successivo",
32
+ "theme.docs.paginator.previous": "Precedente",
33
+ "theme.docs.sidebar.collapseButtonAriaLabel": "Collassa la barra laterale",
34
+ "theme.docs.sidebar.collapseButtonTitle": "Collassa la barra laterale",
35
+ "theme.docs.sidebar.expandButtonAriaLabel": "Espandi la barra laterale",
36
+ "theme.docs.sidebar.expandButtonTitle": "Espandi la barra laterale",
37
+ "theme.docs.tagDocListPageTitle": "{nDocsTagged} con \"{tagName}\"",
38
+ "theme.docs.tagDocListPageTitle.nDocsTagged": "Un documento etichettato|{count} documenti etichettati",
39
+ "theme.docs.versions.latestVersionLinkLabel": "ultima versione",
40
+ "theme.docs.versions.latestVersionSuggestionLabel": "Per la documentazione aggiornata, guarda la {latestVersionLink} ({versionLabel}).",
41
+ "theme.docs.versions.unmaintainedVersionLabel": "Questa è la documentazione per {siteTitle} {versionLabel}, che non è più attivamente mantenuta.",
42
+ "theme.docs.versions.unreleasedVersionLabel": "Questa è documentazione inedita per {siteTitle} versione {versionLabel}.",
43
+ "theme.lastUpdated.atDate": " il {date}",
44
+ "theme.lastUpdated.byUser": " da {user}",
45
+ "theme.lastUpdated.lastUpdatedAtBy": "Ultimo aggiornamento{atDate}{byUser}",
46
+ "theme.navbar.mobileSidebarSecondaryMenu.backButtonLabel": "← Indietro al menu principale",
47
+ "theme.navbar.mobileVersionsDropdown.label": "Versioni",
48
+ "theme.tags.tagsListLabel": "Etichette:",
49
+ "theme.tags.tagsPageLink": "Guarda tutte le etichette",
50
+ "theme.tags.tagsPageTitle": "Etichette"
51
+ }
@@ -0,0 +1,4 @@
1
+ {
2
+ "theme.Playground.liveEditor": "Live Editor",
3
+ "theme.Playground.result": "Risultato"
4
+ }
@@ -0,0 +1,11 @@
1
+ {
2
+ "theme.SearchBar.label": "Cerca",
3
+ "theme.SearchPage.algoliaLabel": "Ricerca tramite Algolia",
4
+ "theme.SearchPage.documentsFound.plurals": "Un documento trovato|{count} documenti trovati",
5
+ "theme.SearchPage.emptyResultsTitle": "Cerca nella documentazione",
6
+ "theme.SearchPage.existingResultsTitle": "Risultati di ricerca per \"{query}\"",
7
+ "theme.SearchPage.fetchingNewResults": "Recuperando nuovi risultati...",
8
+ "theme.SearchPage.inputLabel": "Cerca",
9
+ "theme.SearchPage.inputPlaceholder": "Digita qui la tua ricerca",
10
+ "theme.SearchPage.noResultsText": "Nessun risultato trovato"
11
+ }
@@ -0,0 +1,7 @@
1
+ {
2
+ "theme.IdealImageMessage.404error": "404. Image not found",
3
+ "theme.IdealImageMessage.error": "Error. Click to reload",
4
+ "theme.IdealImageMessage.load": "Click to load{sizeMessage}",
5
+ "theme.IdealImageMessage.loading": "Loading...",
6
+ "theme.IdealImageMessage.offline": "Your browser is offline. Image not loaded"
7
+ }
@@ -0,0 +1,7 @@
1
+ {
2
+ "theme.IdealImageMessage.404error": "404. Image not found",
3
+ "theme.IdealImageMessage.error": "Error. Click to reload",
4
+ "theme.IdealImageMessage.load": "Click to load{sizeMessage}",
5
+ "theme.IdealImageMessage.loading": "Loading...",
6
+ "theme.IdealImageMessage.offline": "Your browser is offline. Image not loaded"
7
+ }
@@ -0,0 +1,7 @@
1
+ {
2
+ "theme.IdealImageMessage.404error": "404. Image not found",
3
+ "theme.IdealImageMessage.error": "Error. Click to reload",
4
+ "theme.IdealImageMessage.load": "Click to load{sizeMessage}",
5
+ "theme.IdealImageMessage.loading": "Loading...",
6
+ "theme.IdealImageMessage.offline": "Your browser is offline. Image not loaded"
7
+ }
@@ -0,0 +1,7 @@
1
+ {
2
+ "theme.IdealImageMessage.404error": "404. Image not found",
3
+ "theme.IdealImageMessage.error": "Error. Click to reload",
4
+ "theme.IdealImageMessage.load": "Click to load{sizeMessage}",
5
+ "theme.IdealImageMessage.loading": "Loading...",
6
+ "theme.IdealImageMessage.offline": "Your browser is offline. Image not loaded"
7
+ }
@@ -0,0 +1,7 @@
1
+ {
2
+ "theme.IdealImageMessage.404error": "404. Image not found",
3
+ "theme.IdealImageMessage.error": "Error. Click to reload",
4
+ "theme.IdealImageMessage.load": "Click to load{sizeMessage}",
5
+ "theme.IdealImageMessage.loading": "Loading...",
6
+ "theme.IdealImageMessage.offline": "Your browser is offline. Image not loaded"
7
+ }
@@ -0,0 +1,7 @@
1
+ {
2
+ "theme.IdealImageMessage.404error": "404. Image not found",
3
+ "theme.IdealImageMessage.error": "Error. Click to reload",
4
+ "theme.IdealImageMessage.load": "Click to load{sizeMessage}",
5
+ "theme.IdealImageMessage.loading": "Loading...",
6
+ "theme.IdealImageMessage.offline": "Your browser is offline. Image not loaded"
7
+ }
@@ -0,0 +1,7 @@
1
+ {
2
+ "theme.IdealImageMessage.404error": "404. Image not found",
3
+ "theme.IdealImageMessage.error": "Error. Click to reload",
4
+ "theme.IdealImageMessage.load": "Click to load{sizeMessage}",
5
+ "theme.IdealImageMessage.loading": "Loading...",
6
+ "theme.IdealImageMessage.offline": "Your browser is offline. Image not loaded"
7
+ }
@@ -0,0 +1,7 @@
1
+ {
2
+ "theme.IdealImageMessage.404error": "404. Image not found",
3
+ "theme.IdealImageMessage.error": "Error. Click to reload",
4
+ "theme.IdealImageMessage.load": "Click to load{sizeMessage}",
5
+ "theme.IdealImageMessage.loading": "Loading...",
6
+ "theme.IdealImageMessage.offline": "Your browser is offline. Image not loaded"
7
+ }
@@ -0,0 +1,7 @@
1
+ {
2
+ "theme.IdealImageMessage.404error": "404. Image not found",
3
+ "theme.IdealImageMessage.error": "Error. Click to reload",
4
+ "theme.IdealImageMessage.load": "Click to load{sizeMessage}",
5
+ "theme.IdealImageMessage.loading": "Loading...",
6
+ "theme.IdealImageMessage.offline": "Your browser is offline. Image not loaded"
7
+ }
@@ -0,0 +1,7 @@
1
+ {
2
+ "theme.IdealImageMessage.404error": "未找到图片",
3
+ "theme.IdealImageMessage.error": "出现错误,点击重试",
4
+ "theme.IdealImageMessage.load": "点击加载图片{sizeMessage}",
5
+ "theme.IdealImageMessage.loading": "加载中……",
6
+ "theme.IdealImageMessage.offline": "你的浏览器处于离线状态。图片未加载"
7
+ }
@@ -0,0 +1,7 @@
1
+ {
2
+ "theme.IdealImageMessage.404error": "未找到圖片",
3
+ "theme.IdealImageMessage.error": "出現錯誤,點擊重試",
4
+ "theme.IdealImageMessage.load": "點擊以加載{sizeMessage}",
5
+ "theme.IdealImageMessage.loading": "加載中...",
6
+ "theme.IdealImageMessage.offline": "你的瀏覽器處於離線狀態。圖片未加載"
7
+ }
package/package.json CHANGED
@@ -1,12 +1,9 @@
1
1
  {
2
2
  "name": "@docusaurus/theme-translations",
3
- "version": "2.0.0-beta.11",
3
+ "version": "2.0.0-beta.15",
4
4
  "description": "Docusaurus theme translations.",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
7
- "files": [
8
- "locales"
9
- ],
10
7
  "publishConfig": {
11
8
  "access": "public"
12
9
  },
@@ -19,18 +16,19 @@
19
16
  "scripts": {
20
17
  "build": "tsc",
21
18
  "watch": "tsc --watch",
22
- "update": "node -e 'require(\"./update.js\").run()'"
19
+ "update": "node ./update.js"
23
20
  },
24
21
  "dependencies": {
25
22
  "fs-extra": "^10.0.0",
26
23
  "tslib": "^2.3.1"
27
24
  },
28
25
  "devDependencies": {
29
- "chalk": "^4.1.2",
26
+ "@docusaurus/core": "2.0.0-beta.15",
27
+ "@docusaurus/logger": "2.0.0-beta.15",
30
28
  "lodash": "^4.17.20"
31
29
  },
32
30
  "engines": {
33
31
  "node": ">=14"
34
32
  },
35
- "gitHead": "1cb6cdfb78c0bfc681bce9a9339270abb9a06215"
33
+ "gitHead": "9a8acb2a87250368427ad80258350d630e7ae2f5"
36
34
  }
package/src/index.ts ADDED
@@ -0,0 +1,60 @@
1
+ /**
2
+ * Copyright (c) Facebook, Inc. and its affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+
8
+ import path from 'path';
9
+ import fs from 'fs-extra';
10
+
11
+ function getDefaultLocalesDirPath(): string {
12
+ return path.join(__dirname, '../locales');
13
+ }
14
+
15
+ // Return an ordered list of locales we should try
16
+ export function codeTranslationLocalesToTry(locale: string): string[] {
17
+ const intlLocale = new Intl.Locale(locale);
18
+ // if locale is just a simple language like "pt", we want to fallback to pt-BR (not pt-PT!)
19
+ // see https://github.com/facebook/docusaurus/pull/4536#issuecomment-810088783
20
+ if (intlLocale.language === locale) {
21
+ const maximizedLocale = intlLocale.maximize(); // pt-Latn-BR`
22
+ // ["pt","pt-BR"]; ["zh", "zh-Hans"]
23
+ return [
24
+ locale,
25
+ `${maximizedLocale.language}-${maximizedLocale.region}`,
26
+ `${maximizedLocale.language}-${maximizedLocale.script}`,
27
+ ];
28
+ }
29
+ // if locale is like "pt-BR", we want to fallback to "pt"
30
+ else {
31
+ return [locale, intlLocale.language!];
32
+ }
33
+ }
34
+
35
+ // Useful to implement getDefaultCodeTranslationMessages() in themes
36
+ export async function readDefaultCodeTranslationMessages({
37
+ dirPath = getDefaultLocalesDirPath(),
38
+ locale,
39
+ name,
40
+ }: {
41
+ dirPath?: string;
42
+ locale: string;
43
+ name: string;
44
+ }): Promise<Record<string, string>> {
45
+ const localesToTry = codeTranslationLocalesToTry(locale);
46
+
47
+ // Return the content of the first file that match
48
+ // fr_FR.json => fr.json => nothing
49
+ // eslint-disable-next-line no-restricted-syntax
50
+ for (const localeToTry of localesToTry) {
51
+ const filePath = path.resolve(dirPath, localeToTry, `${name}.json`);
52
+
53
+ if (await fs.pathExists(filePath)) {
54
+ const fileContent = await fs.readFile(filePath, 'utf8');
55
+ return JSON.parse(fileContent);
56
+ }
57
+ }
58
+
59
+ return {};
60
+ }