mirror of
https://github.com/h3poteto/whalebird-desktop
synced 2025-01-31 17:45:22 +01:00
Merge pull request #1113 from h3poteto/iss-1106
refs #1106 Always fallback to English when the translation key is missing
This commit is contained in:
commit
0c15bfe473
6
package-lock.json
generated
6
package-lock.json
generated
@ -5331,7 +5331,7 @@
|
||||
"dependencies": {
|
||||
"resolve": {
|
||||
"version": "1.1.7",
|
||||
"resolved": "https://registry.npmjs.org/resolve/-/resolve-1.1.7.tgz",
|
||||
"resolved": "http://registry.npmjs.org/resolve/-/resolve-1.1.7.tgz",
|
||||
"integrity": "sha1-IDEU2CrSxe2ejgQRs5ModeiJ6Xs=",
|
||||
"dev": true
|
||||
}
|
||||
@ -14527,7 +14527,7 @@
|
||||
},
|
||||
"readable-stream": {
|
||||
"version": "2.3.6",
|
||||
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz",
|
||||
"resolved": "http://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz",
|
||||
"integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
@ -14542,7 +14542,7 @@
|
||||
},
|
||||
"string_decoder": {
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz",
|
||||
"resolved": "http://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz",
|
||||
"integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
|
@ -1,40 +1,17 @@
|
||||
import * as path from 'path'
|
||||
import fs from 'fs'
|
||||
import keys from 'all-object-keys'
|
||||
import objectAssignDeep from 'object-assign-deep'
|
||||
|
||||
const defaultLocale = 'en'
|
||||
const locales = ['de', 'fr', 'it', 'ja', 'ko', 'pl', 'zh_cn']
|
||||
|
||||
const enJson = JSON.parse(fs.readFileSync(path.resolve(__dirname, `../../src/config/locales/${defaultLocale}/translation.json`), 'utf8'))
|
||||
|
||||
describe('i18n', () => {
|
||||
describe('should be same keys', () => {
|
||||
locales.map(locale => {
|
||||
it(`${locale} translation`, () => {
|
||||
const targetJson = JSON.parse(
|
||||
fs.readFileSync(path.resolve(__dirname, `../../src/config/locales/${locale}/translation.json`), 'utf8')
|
||||
)
|
||||
const targetMissingJson = JSON.parse(
|
||||
fs.readFileSync(path.resolve(__dirname, `../../src/config/locales/${locale}/translation.missing.json`), 'utf8')
|
||||
)
|
||||
const enKeys = keys(enJson)
|
||||
const targetKeys = keys(objectAssignDeep(targetJson, targetMissingJson))
|
||||
expect(enKeys.sort()).toEqual(targetKeys.sort())
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
describe('should not define duplicate keys', () => {
|
||||
locales.map(locale => {
|
||||
it(`${locale} translation`, () => {
|
||||
const targetJson = JSON.parse(
|
||||
fs.readFileSync(path.resolve(__dirname, `../../src/config/locales/${locale}/translation.json`), 'utf8')
|
||||
)
|
||||
const targetMissingJson = JSON.parse(
|
||||
fs.readFileSync(path.resolve(__dirname, `../../src/config/locales/${locale}/translation.missing.json`), 'utf8')
|
||||
)
|
||||
const allKeys = keys(targetJson).concat(keys(targetMissingJson))
|
||||
const allKeys = keys(targetJson)
|
||||
const duplicates: Array<string> = allKeys.filter(
|
||||
(x: string, _: number, self: Array<string>) => self.indexOf(x) !== self.lastIndexOf(x)
|
||||
)
|
||||
|
@ -5,20 +5,20 @@ import Backend from 'i18next-sync-fs-backend'
|
||||
const options: InitOptions = {
|
||||
initImmediate: false,
|
||||
lng: 'en',
|
||||
fallbackLng: 'en',
|
||||
saveMissing: true,
|
||||
backend: {
|
||||
// path where resources get loaded from
|
||||
loadPath: path.resolve(__dirname, './locales/{{lng}}/{{ns}}.json'),
|
||||
|
||||
// path to post missing resources
|
||||
addPath: path.resolve(__dirname, './locales/{{lng}}/{{ns}}.missing.json'),
|
||||
addPath: path.resolve(__dirname, './locales/en/{{ns}}.json'),
|
||||
|
||||
// jsonIndent to use when storing json files
|
||||
jsonIndent: 2
|
||||
}
|
||||
}
|
||||
|
||||
i18next
|
||||
.use(Backend)
|
||||
.init(options)
|
||||
i18next.use(Backend).init(options)
|
||||
|
||||
export default i18next
|
||||
|
@ -1,88 +0,0 @@
|
||||
{
|
||||
"side_menu": {
|
||||
"follow_requests": "Follow Requests"
|
||||
},
|
||||
"header_menu": {
|
||||
"follow_requests": "Follow Requests",
|
||||
"filter": {
|
||||
"show_dms": "Show direct messages"
|
||||
}
|
||||
},
|
||||
"settings": {
|
||||
"timeline": {
|
||||
"unread_notification": {
|
||||
"title": "Unread Notification",
|
||||
"description": "Customize unread notifications for each timelines."
|
||||
}
|
||||
}
|
||||
},
|
||||
"search": {
|
||||
"tag": "Hashtag"
|
||||
},
|
||||
"modals": {
|
||||
"shortcut": {
|
||||
"title": "Keyboard shortcuts",
|
||||
"ctrl_number": "Switch accounts",
|
||||
"ctrl_k": "Jump to other timelines",
|
||||
"ctrl_n": "Open the new toot modal",
|
||||
"ctrl_enter": "Post the toot",
|
||||
"ctrl_r": "Reload current timeline",
|
||||
"j": "Select the next toot",
|
||||
"k": "Select the previous toot",
|
||||
"h": "Switch the focus to left column",
|
||||
"l": "Switch the focus to right column",
|
||||
"r": "Reply to the toot",
|
||||
"b": "Reblog the toot",
|
||||
"f": "Favourite the toot",
|
||||
"o": "Open details of the toot",
|
||||
"p": "Open account profile of the toot",
|
||||
"i": "Open the images",
|
||||
"x": "Show/hide CW and NSFW",
|
||||
"esc": "Close current page"
|
||||
}
|
||||
},
|
||||
"preferences": {
|
||||
"general": {
|
||||
"timeline": {
|
||||
"description": "Customize view in your timelines."
|
||||
},
|
||||
"other": {
|
||||
"title": "Other options",
|
||||
"launch": "Launch app on login"
|
||||
}
|
||||
},
|
||||
"network": {
|
||||
"title": "Network",
|
||||
"proxy": {
|
||||
"title": "Proxy Configuration",
|
||||
"no": "No proxy",
|
||||
"system": "Use system proxy",
|
||||
"manual": "Manual proxy configuration",
|
||||
"protocol": "Protocol",
|
||||
"host": "Proxy host",
|
||||
"port": "Proxy port",
|
||||
"username": "Proxy username",
|
||||
"password": "Proxy password",
|
||||
"protocol_list": {
|
||||
"http": "http",
|
||||
"https": "https",
|
||||
"socks4": "socks4",
|
||||
"socks4a": "socks4a",
|
||||
"socks5": "socks5",
|
||||
"socks5h": "socks5h"
|
||||
}
|
||||
},
|
||||
"save": "Save"
|
||||
}
|
||||
},
|
||||
"message": {
|
||||
"follow_request_accept_error": "Failed to accept the request",
|
||||
"follow_reuqest_reject_error": "failed to reject the request",
|
||||
"start_all_streamings_error": "Failed to start streaming of {{domain}}",
|
||||
"domain_doesnt_exist": "Failed to connect {{domain}}, make sure the server URL"
|
||||
},
|
||||
"login": {
|
||||
"proxy_info": "If you want to use proxy server, please setup your proxy in",
|
||||
"proxy_here": " here"
|
||||
}
|
||||
}
|
@ -1 +0,0 @@
|
||||
{}
|
@ -1,45 +0,0 @@
|
||||
{
|
||||
"modals": {
|
||||
"shortcut": {
|
||||
"ctrl_r": "Reload current timeline"
|
||||
}
|
||||
},
|
||||
"preferences": {
|
||||
"general": {
|
||||
"other": {
|
||||
"title": "Other options",
|
||||
"launch": "Launch app on login"
|
||||
}
|
||||
},
|
||||
"network": {
|
||||
"title": "Network",
|
||||
"proxy": {
|
||||
"title": "Proxy Configuration",
|
||||
"no": "No proxy",
|
||||
"system": "Use system proxy",
|
||||
"manual": "Manual proxy configuration",
|
||||
"protocol": "Protocol",
|
||||
"host": "Proxy host",
|
||||
"port": "Proxy port",
|
||||
"username": "Proxy username",
|
||||
"password": "Proxy password",
|
||||
"protocol_list": {
|
||||
"http": "http",
|
||||
"https": "https",
|
||||
"socks4": "socks4",
|
||||
"socks4a": "socks4a",
|
||||
"socks5": "socks5",
|
||||
"socks5h": "socks5h"
|
||||
}
|
||||
},
|
||||
"save": "Save"
|
||||
}
|
||||
},
|
||||
"login": {
|
||||
"proxy_info": "If you want to use proxy server, please setup your proxy in",
|
||||
"proxy_here": " here"
|
||||
},
|
||||
"message": {
|
||||
"domain_doesnt_exist": "Failed to connect {{domain}}, make sure the server URL"
|
||||
}
|
||||
}
|
@ -1 +0,0 @@
|
||||
{}
|
@ -1 +0,0 @@
|
||||
{}
|
@ -1,126 +0,0 @@
|
||||
{
|
||||
"preferences": {
|
||||
"general": {
|
||||
"timeline": {
|
||||
"title": "Timeline",
|
||||
"description": "Customize view in your timelines.",
|
||||
"cw": "Always ignore contents warnings",
|
||||
"nfsw": "Always ignore NFSW of medias",
|
||||
"hideAllAttachments": "Hide all medias"
|
||||
},
|
||||
"other": {
|
||||
"title": "Other options",
|
||||
"launch": "Launch app on login"
|
||||
}
|
||||
},
|
||||
"appearance": {
|
||||
"toot_padding": "Padding around toot"
|
||||
},
|
||||
"network": {
|
||||
"title": "Network",
|
||||
"proxy": {
|
||||
"title": "Proxy Configuration",
|
||||
"no": "No proxy",
|
||||
"system": "Use system proxy",
|
||||
"manual": "Manual proxy configuration",
|
||||
"protocol": "Protocol",
|
||||
"host": "Proxy host",
|
||||
"port": "Proxy port",
|
||||
"username": "Proxy username",
|
||||
"password": "Proxy password",
|
||||
"protocol_list": {
|
||||
"http": "http",
|
||||
"https": "https",
|
||||
"socks4": "socks4",
|
||||
"socks4a": "socks4a",
|
||||
"socks5": "socks5",
|
||||
"socks5h": "socks5h"
|
||||
}
|
||||
},
|
||||
"save": "Save"
|
||||
}
|
||||
},
|
||||
"side_menu": {
|
||||
"mention": "Mentions",
|
||||
"follow_requests": "Follow Requests"
|
||||
},
|
||||
"header_menu": {
|
||||
"mention": "Mentions",
|
||||
"follow_requests": "Follow Requests",
|
||||
"filter": {
|
||||
"show_dms": "Show direct messages"
|
||||
}
|
||||
},
|
||||
"follow_requests": {
|
||||
"accept": "Accept",
|
||||
"reject": "Reject"
|
||||
},
|
||||
"modals": {
|
||||
"new_toot": {
|
||||
"footer": {
|
||||
"poll": "Add a poll"
|
||||
},
|
||||
"poll": {
|
||||
"add_choice": "Add a choice",
|
||||
"expires": {
|
||||
"5_minutes": "5 minutes",
|
||||
"30_minutes": "30 minutes",
|
||||
"1_hour": "1 hour",
|
||||
"6_hours": "6 hours",
|
||||
"1_day": "1 day",
|
||||
"3_days": "3 days",
|
||||
"7_days": "7 days"
|
||||
}
|
||||
}
|
||||
},
|
||||
"report": {
|
||||
"title": "Reporting this user",
|
||||
"comment": "Additional comments",
|
||||
"cancel": "Cancel",
|
||||
"ok": "Report"
|
||||
},
|
||||
"shortcut": {
|
||||
"ctrl_r": "Reload current timeline"
|
||||
}
|
||||
},
|
||||
"cards": {
|
||||
"toot": {
|
||||
"poll": {
|
||||
"vote": "Vote",
|
||||
"votes_count": "votes",
|
||||
"until": "until {{datetime}}",
|
||||
"left": "{{datetime}} left",
|
||||
"refresh": "Refresh"
|
||||
}
|
||||
}
|
||||
},
|
||||
"message": {
|
||||
"follow_request_accept_error": "Failed to accept the request",
|
||||
"follow_reuqest_reject_error": "failed to reject the request",
|
||||
"start_all_streamings_error": "Failed to start streaming of {{domain}}",
|
||||
"domain_doesnt_exist": "Failed to connect {{domain}}, make sure the server URL"
|
||||
},
|
||||
"validation": {
|
||||
"new_toot": {
|
||||
"poll_invalid": "Invalid poll choices"
|
||||
}
|
||||
},
|
||||
"notification": {
|
||||
"favourite": {
|
||||
"title": "Favourite",
|
||||
"body": "{{username}} favourited your status"
|
||||
},
|
||||
"follow": {
|
||||
"title": "Follow",
|
||||
"body": "{{username}} is now following you"
|
||||
},
|
||||
"reblog": {
|
||||
"title": "Reblog",
|
||||
"body": "{{username}} boosted your status"
|
||||
}
|
||||
},
|
||||
"login": {
|
||||
"proxy_info": "If you want to use proxy server, please setup your proxy in",
|
||||
"proxy_here": " here"
|
||||
}
|
||||
}
|
@ -1,147 +0,0 @@
|
||||
{
|
||||
"side_menu": {
|
||||
"mention": "Mentions",
|
||||
"direct": "Direct messages",
|
||||
"follow_requests": "Follow Requests"
|
||||
},
|
||||
"header_menu": {
|
||||
"settings": "Settings",
|
||||
"follow_requests": "Follow Requests",
|
||||
"mention": "Mentions",
|
||||
"direct_messages": "Direct Messages",
|
||||
"filter": {
|
||||
"show_dms": "Show direct messages"
|
||||
}
|
||||
},
|
||||
"settings": {
|
||||
"timeline": {
|
||||
"title": "Timeline",
|
||||
"unread_notification": {
|
||||
"title": "Unread Notification",
|
||||
"description": "Customize unread notifications for each timelines.",
|
||||
"direct": "Direct Messages",
|
||||
"local": "Local Timeline",
|
||||
"public": "Public Timeline"
|
||||
}
|
||||
}
|
||||
},
|
||||
"search": {
|
||||
"tag": "Hashtag"
|
||||
},
|
||||
"modals": {
|
||||
"new_toot": {
|
||||
"footer": {
|
||||
"poll": "Add a poll"
|
||||
},
|
||||
"poll": {
|
||||
"add_choice": "Add a choice",
|
||||
"expires": {
|
||||
"5_minutes": "5 minutes",
|
||||
"30_minutes": "30 minutes",
|
||||
"1_hour": "1 hour",
|
||||
"6_hours": "6 hours",
|
||||
"1_day": "1 day",
|
||||
"3_days": "3 days",
|
||||
"7_days": "7 days"
|
||||
}
|
||||
}
|
||||
},
|
||||
"report": {
|
||||
"title": "Reporting this user",
|
||||
"comment": "Additional comments",
|
||||
"cancel": "Cancel",
|
||||
"ok": "Report"
|
||||
},
|
||||
"shortcut": {
|
||||
"ctrl_r": "Reload current timeline",
|
||||
"h": "Switch the focus to left column",
|
||||
"l": "Switch the focus to right column",
|
||||
"?": "Show this help"
|
||||
}
|
||||
},
|
||||
"preferences": {
|
||||
"general": {
|
||||
"timeline": {
|
||||
"title": "Timeline",
|
||||
"description": "Customize view in your timelines.",
|
||||
"cw": "Always ignore contents warnings",
|
||||
"nfsw": "Always ignore NFSW of medias",
|
||||
"hideAllAttachments": "Hide all medias"
|
||||
},
|
||||
"other": {
|
||||
"title": "Other options",
|
||||
"launch": "Launch app on login"
|
||||
}
|
||||
},
|
||||
"appearance": {
|
||||
"toot_padding": "Padding around toot"
|
||||
},
|
||||
"network": {
|
||||
"title": "Network",
|
||||
"proxy": {
|
||||
"title": "Proxy Configuration",
|
||||
"no": "No proxy",
|
||||
"system": "Use system proxy",
|
||||
"manual": "Manual proxy configuration",
|
||||
"protocol": "Protocol",
|
||||
"host": "Proxy host",
|
||||
"port": "Proxy port",
|
||||
"username": "Proxy username",
|
||||
"password": "Proxy password",
|
||||
"protocol_list": {
|
||||
"http": "http",
|
||||
"https": "https",
|
||||
"socks4": "socks4",
|
||||
"socks4a": "socks4a",
|
||||
"socks5": "socks5",
|
||||
"socks5h": "socks5h"
|
||||
}
|
||||
},
|
||||
"save": "Save"
|
||||
}
|
||||
},
|
||||
"follow_requests": {
|
||||
"accept": "Accept",
|
||||
"reject": "Reject"
|
||||
},
|
||||
"cards": {
|
||||
"toot": {
|
||||
"poll": {
|
||||
"vote": "Vote",
|
||||
"votes_count": "votes",
|
||||
"until": "until {{datetime}}",
|
||||
"left": "{{datetime}} left",
|
||||
"refresh": "Refresh"
|
||||
}
|
||||
}
|
||||
},
|
||||
"message": {
|
||||
"follow_request_accept_error": "Failed to accept the request",
|
||||
"follow_reuqest_reject_error": "failed to reject the request",
|
||||
"start_all_streamings_error": "Failed to start streaming of {{domain}}",
|
||||
"domain_doesnt_exist": "Failed to connect {{domain}}, make sure the server URL"
|
||||
},
|
||||
"validation": {
|
||||
"new_toot": {
|
||||
"poll_invalid": "Invalid poll choices"
|
||||
}
|
||||
},
|
||||
"notification": {
|
||||
"favourite": {
|
||||
"title": "Favourite",
|
||||
"body": "{{username}} favourited your status"
|
||||
},
|
||||
"follow": {
|
||||
"title": "Follow",
|
||||
"body": "{{username}} is now following you"
|
||||
},
|
||||
"reblog": {
|
||||
"title": "Reblog",
|
||||
"body": "{{username}} boosted your status"
|
||||
}
|
||||
},
|
||||
"login": {
|
||||
"proxy_info": "If you want to use proxy server, please setup your proxy in",
|
||||
"proxy_here": " here"
|
||||
}
|
||||
}
|
@ -1,45 +0,0 @@
|
||||
{
|
||||
"modals": {
|
||||
"shortcut": {
|
||||
"ctrl_r": "Reload current timeline"
|
||||
}
|
||||
},
|
||||
"preferences": {
|
||||
"general": {
|
||||
"other": {
|
||||
"title": "Other options",
|
||||
"launch": "Launch app on login"
|
||||
}
|
||||
},
|
||||
"network": {
|
||||
"title": "Network",
|
||||
"proxy": {
|
||||
"title": "Proxy Configuration",
|
||||
"no": "No proxy",
|
||||
"system": "Use system proxy",
|
||||
"manual": "Manual proxy configuration",
|
||||
"protocol": "Protocol",
|
||||
"host": "Proxy host",
|
||||
"port": "Proxy port",
|
||||
"username": "Proxy username",
|
||||
"password": "Proxy password",
|
||||
"protocol_list": {
|
||||
"http": "http",
|
||||
"https": "https",
|
||||
"socks4": "socks4",
|
||||
"socks4a": "socks4a",
|
||||
"socks5": "socks5",
|
||||
"socks5h": "socks5h"
|
||||
}
|
||||
},
|
||||
"save": "Save"
|
||||
}
|
||||
},
|
||||
"login": {
|
||||
"proxy_info": "If you want to use proxy server, please setup your proxy in",
|
||||
"proxy_here": " here"
|
||||
},
|
||||
"message": {
|
||||
"domain_doesnt_exist": "Failed to connect {{domain}}, make sure the server URL"
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user