feat(mobile): translation for settings (#3391)
* feat(mobile): translation for settings * general * appearance * data control * account * invitation * about * privacy * list * actions * update action * update list and common words * settings
This commit is contained in:
+15
-39
@@ -1,45 +1,20 @@
|
||||
import fs from "node:fs"
|
||||
import path from "node:path"
|
||||
|
||||
const sourceDir = "./locales/app"
|
||||
const sourceDir = "./locales/common"
|
||||
const targetDir = "./locales/common"
|
||||
const keysToCopy: string[] = [
|
||||
"feed_view_type.articles",
|
||||
"feed_view_type.audios",
|
||||
"feed_view_type.notifications",
|
||||
"feed_view_type.pictures",
|
||||
"feed_view_type.social_media",
|
||||
"feed_view_type.videos",
|
||||
// kept the duplicate keys in locales/app
|
||||
"words.starred",
|
||||
"words.inbox",
|
||||
"words.feeds",
|
||||
"words.lists",
|
||||
"words.search",
|
||||
"discover.category.all",
|
||||
"discover.category.anime",
|
||||
"discover.category.bbs",
|
||||
"discover.category.blog",
|
||||
"discover.category.design",
|
||||
"discover.category.finance",
|
||||
"discover.category.forecast",
|
||||
"discover.category.game",
|
||||
"discover.category.government",
|
||||
"discover.category.journal",
|
||||
"discover.category.live",
|
||||
"discover.category.multimedia",
|
||||
"discover.category.new-media",
|
||||
"discover.category.picture",
|
||||
"discover.category.program-update",
|
||||
"discover.category.programming",
|
||||
"discover.category.reading",
|
||||
"discover.category.shopping",
|
||||
"discover.category.social-media",
|
||||
"discover.category.study",
|
||||
"discover.category.traditional-media",
|
||||
"discover.category.travel",
|
||||
"discover.category.university",
|
||||
// // kept the duplicate keys in locales/app
|
||||
// "words.starred",
|
||||
// "words.inbox",
|
||||
// "words.feeds",
|
||||
// "words.lists",
|
||||
// "words.search",
|
||||
"cancel",
|
||||
"close",
|
||||
"confirm",
|
||||
]
|
||||
const keysToPlace = ["words.cancel", "words.close", "words.confirm"]
|
||||
|
||||
const copyTranslations = (sourceDir: string, targetDir: string) => {
|
||||
const sourceFiles = fs.readdirSync(sourceDir)
|
||||
@@ -57,9 +32,10 @@ const copyTranslations = (sourceDir: string, targetDir: string) => {
|
||||
? JSON.parse(fs.readFileSync(targetFilePath, "utf-8"))
|
||||
: {}
|
||||
|
||||
keysToCopy.forEach((key) => {
|
||||
if (sourceContent[key] && !targetContent[key]) {
|
||||
targetContent[key] = sourceContent[key]
|
||||
keysToCopy.forEach((key, index) => {
|
||||
const targetKey = keysToPlace[index] ?? key
|
||||
if (sourceContent[key] && !targetContent[targetKey]) {
|
||||
targetContent[targetKey] = sourceContent[key]
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user