fix(v2): update code translations script + update some translations (#4349)

This commit is contained in:
Sébastien Lorber 2021-03-05 14:52:59 +01:00 committed by GitHub
parent 8bc23197a9
commit 4f419801da
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 67 additions and 60 deletions

View file

@ -13,6 +13,7 @@
"theme.PwaReloadPopup.refreshButtonText": "تحديث",
"theme.SearchBar.label": "بحث",
"theme.SearchPage.algoliaLabel": "البحث بواسطه Algolia",
"theme.SearchPage.documentsFound.plurals": "One document found|{count} documents found",
"theme.SearchPage.emptyResultsTitle": "ابحث في الوثائق",
"theme.SearchPage.existingResultsTitle": "نتائج البحث عن \"{query}\"",
"theme.SearchPage.fetchingNewResults": "جلب نتائج جديدة ...",
@ -22,13 +23,12 @@
"theme.blog.paginator.navAriaLabel": "التنقل في صفحة قائمة المدونة",
"theme.blog.paginator.newerEntries": "إدخالات أحدث",
"theme.blog.paginator.olderEntries": "إدخالات أقدم",
"theme.blog.post.nPosts": "{count} مقالات",
"theme.blog.post.onePost": "مقاله واحده",
"theme.blog.post.paginator.navAriaLabel": "التنقل في صفحة مقالات المدونة",
"theme.blog.post.paginator.newerPost": "مقالات أحدث",
"theme.blog.post.paginator.olderPost": "مقالات أقدم",
"theme.blog.post.plurals": "مقاله واحده|{count} مقالات",
"theme.blog.post.readMore": "اقرأ المزيد",
"theme.blog.post.readingTime": "{readingTime} دقائق قراءة",
"theme.blog.post.readingTime.plurals": "{readingTime} دقائق قراءة|{readingTime} دقائق قراءة",
"theme.blog.tagTitle": "{nPosts} موسومة ب \"{tagName}\"",
"theme.common.editThisPage": "تعديل هذه الصفحة",
"theme.common.headingLinkTitle": "ارتباط مباشر بالعنوان",

View file

@ -13,6 +13,7 @@
"theme.PwaReloadPopup.refreshButtonText": "Odśwież",
"theme.SearchBar.label": "Szukaj",
"theme.SearchPage.algoliaLabel": "Dostawca rozwiązania Algolia",
"theme.SearchPage.documentsFound.plurals": "One document found|{count} documents found",
"theme.SearchPage.emptyResultsTitle": "Wyszukaj w dokumentacji",
"theme.SearchPage.existingResultsTitle": "Wyniki wyszukiwania dla \"{query}\"",
"theme.SearchPage.fetchingNewResults": "Pobieranie nowych wyników…",
@ -22,13 +23,12 @@
"theme.blog.paginator.navAriaLabel": "Nawigacja na stronie listy wpisów na blogu",
"theme.blog.paginator.newerEntries": "Nowsze wpisy",
"theme.blog.paginator.olderEntries": "Starsze wpisy",
"theme.blog.post.nPosts": "{count} posty",
"theme.blog.post.onePost": "Jeden post",
"theme.blog.post.paginator.navAriaLabel": "Nawigacja na stronie postu na blogu",
"theme.blog.post.paginator.newerPost": "Nowszy posty",
"theme.blog.post.paginator.olderPost": "Starszy posty",
"theme.blog.post.plurals": "Jeden post|{count} posty|{count} postów",
"theme.blog.post.readMore": "Czytaj więcej",
"theme.blog.post.readingTime": "{readingTime} min aby przeczytać",
"theme.blog.post.readingTime.plurals": "{readingTime} min aby przeczytać|{readingTime} min aby przeczytać|{readingTime} min aby przeczytać",
"theme.blog.tagTitle": "{nPosts} z tagiem \"{tagName}\"",
"theme.common.editThisPage": "Edytuj tą stronę",
"theme.common.headingLinkTitle": "Bezpośredni link do nagłówka",

View file

@ -9,7 +9,7 @@ const chalk = require('chalk');
const path = require('path');
const fs = require('fs-extra');
const globby = require('globby');
const {mapValues, difference} = require('lodash');
const {mapValues, pickBy, difference} = require('lodash');
const CodeDirPaths = [
path.join(__dirname, 'lib-next'),
@ -101,8 +101,14 @@ async function getCodeTranslationFiles() {
return {baseFile, localesFiles};
}
const DescriptionSuffix = '___DESCRIPTION';
async function updateBaseFile(baseFile) {
const baseMessages = await readMessagesFile(baseFile);
const baseMessagesWithDescriptions = await readMessagesFile(baseFile);
const baseMessages = pickBy(
baseMessagesWithDescriptions,
(_, key) => !key.endsWith(DescriptionSuffix),
);
const codeExtractedTranslations = await extractThemeCodeMessages();
const codeMessages = mapValues(
@ -132,7 +138,8 @@ ${logKeys(unknownMessages)}`),
(acc, [key]) => {
return {
...acc,
[`${key}___DESCRIPTION`]: codeExtractedTranslations[key].description,
[`${key}${DescriptionSuffix}`]: codeExtractedTranslations[key]
.description,
};
},
{},