Skip to content

Commit

Permalink
docs(i18n): sync i18n files from crowdin (DimensionDev#3957)
Browse files Browse the repository at this point in the history
  • Loading branch information
Jack-Works authored Aug 16, 2021
1 parent 96b5f48 commit 1be35d8
Show file tree
Hide file tree
Showing 56 changed files with 1,908 additions and 618 deletions.
22 changes: 17 additions & 5 deletions .i18n-codegen.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
"version": 1,
"list": [
{
"input": "./packages/maskbook/src/_locales/en-US/messages.json",
"output": "./packages/maskbook/src/_locales/i18n_generated",
"input": "./packages/maskbook/src/locales/en-US.json",
"output": "./packages/maskbook/src/locales/i18n_generated",
"parser": "i18next",
"generator": {
"type": "i18next/react-hooks",
Expand All @@ -14,15 +14,27 @@
"sourceMap": "inline"
}
},
{
"input": "./packages/maskbook/src/social-network-adaptor/twitter.com/locales/en-US.json",
"output": "./packages/maskbook/src/social-network-adaptor/twitter.com/locales/i18n_generated",
"parser": "i18next",
"generator": {
"type": "i18next/react-hooks",
"hooks": "useDO_NOT_USE",
"namespace": "DO_NOT_USE",
"trans": "DO_NOT_USE_TRANSLATOR",
"sourceMap": false
}
},
{
"input": "./packages/shared/src/locales/en-US.json",
"output": "./packages/shared/src/locales/i18n_generated",
"parser": "i18next",
"generator": {
"type": "i18next/react-hooks",
"hooks": "useMaskThemeI18N",
"namespace": "theme",
"trans": "ThemeTrans",
"hooks": "useSharedI18N",
"namespace": "shared",
"trans": "SharedTrans",
"sourceMap": "inline"
}
},
Expand Down
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"url": "http://json-schema.org/draft-07/schema"
},
{
"fileMatch": ["/packages/maskbook/src/_locales/*/messages.json"],
"fileMatch": ["/packages/maskbook/src/locales/*.json"],
"url": "/.vscode/schema/locale.json"
},
{
Expand Down
4 changes: 0 additions & 4 deletions crowdin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@ preserve_hierarchy: true
pull_request_title: 'docs(i18n): sync i18n files from Crowdin'
commit_message: 'docs(i18n): sync translation %original_file_name% for %language%'
files:
- source: /packages/maskbook/src/_locales/en-US/messages.json
translation: /packages/maskbook/src/_locales/%locale%/messages.json
update_option: 'update_as_unapproved'
skip_untranslated_strings: true
- source: /packages/**/locales/en-US.json
translation: /packages/**/locales/%locale%.json
update_option: 'update_as_unapproved'
Expand Down
6 changes: 3 additions & 3 deletions packages/dashboard/.storybook/preview.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@ import React from 'react'
import { ThemeProvider, StyledEngineProvider } from '@material-ui/core'
import { StylesProvider } from '@material-ui/styles'
import { MaskLightTheme, applyMaskColorVars, CustomSnackbarProvider } from '@masknet/theme'
import { addMaskSharedI18N } from '@masknet/shared'
import { addMaskSharedI18N, fallbackLng } from '@masknet/shared'
import { withMatrix } from 'storybook-addon-matrix'
import { addDashboardI18N } from '../src/locales'
import { I18nextProvider, initReactI18next } from 'react-i18next'
import i18n from 'i18next'
i18n.init({
resources: {},
keySeparator: false,
interpolation: { escapeValue: false },
fallbackLng: 'en',
fallbackLng,
nonExplicitSupportedLngs: true,
})
i18n.use(initReactI18next)
addDashboardI18N(i18n)
Expand Down
1 change: 1 addition & 0 deletions packages/dashboard/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
"color": "^3.1.3",
"date-fns": "2.21.3",
"history": "^5.0.0",
"i18next-browser-languagedetector": "^6.1.2",
"json-stable-stringify": "^1.0.1",
"lodash-es": "^4.17.21",
"react-hook-form": "^7.11.1",
Expand Down
18 changes: 12 additions & 6 deletions packages/dashboard/src/initialization/i18n.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,20 @@
import i18n from 'i18next'
import { addMaskSharedI18N } from '@masknet/shared'
import Detector from 'i18next-browser-languagedetector'
import { addSharedI18N, fallbackLng } from '@masknet/shared'
import { addDashboardI18N } from '../locales'
import { initReactI18next } from 'react-i18next'

i18n.init({
resources: {},
i18n.use(Detector).init({
keySeparator: false,
interpolation: { escapeValue: false },
fallbackLng: 'en',
interpolation: {
escapeValue: false,
},
fallbackLng,
nonExplicitSupportedLngs: true,
detection: {
order: ['navigator'],
},
})
i18n.use(initReactI18next)
addMaskSharedI18N(i18n)
addSharedI18N(i18n)
addDashboardI18N(i18n)
1 change: 1 addition & 0 deletions packages/dashboard/src/locales/en-US.json
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@
"settings_profile": "Profile",
"settings_language_title": "Language",
"settings_language_desc": "Select the language you would like to use",
"settings_language_auto": "Follow system",
"settings_appearance_title": "Appearance",
"settings_appearance_desc": "Select the theme you would like to use",
"settings_data_source_title": "Data Source",
Expand Down
29 changes: 18 additions & 11 deletions packages/dashboard/src/locales/index.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,20 @@
// This file is auto generated. DO NOT EDIT
// Run `npx gulp sync-languages` to regenerate.
import en_US from './en-US.json'
import ja_JP from './ja-JP.json'
import ko_KR from './ko-KR.json'
import qya_AA from './qya-AA.json'
import zh_CN from './zh-CN.json'
import zh_TW from './zh-TW.json'

export * from './i18n_generated'
export const languages = {
'en-US': en_US,
'ja-JP': ja_JP,
'ko-KR': ko_KR,
'qya-AA': qya_AA,
'zh-CN': zh_CN,
'zh-TW': zh_TW,
}
import { createI18NBundle } from '@masknet/shared'
import en from './en-US.json'
import zh from './zh-TW.json'
import jp from './ja-JP.json'
import ko from './ko-KR.json'

export const addDashboardI18N = createI18NBundle('dashboard', {
en,
zh,
jp,
ko,
})
export const addDashboardI18N = createI18NBundle('dashboard', languages)
175 changes: 175 additions & 0 deletions packages/dashboard/src/locales/qya-AA.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,175 @@
{
"about": "crwdns1619:0crwdne1619:0",
"wallets": "crwdns1621:0crwdne1621:0",
"personas": "crwdns1623:0crwdne1623:0",
"about_dialog_license": "crwdns1625:0crwdne1625:0",
"footer_bounty_list": "crwdns1627:0crwdne1627:0",
"about_dialog_source_code": "crwdns1629:0crwdne1629:0",
"about_dialog_feedback": "crwdns1631:0crwdne1631:0",
"about_dialog_touch": "crwdns1633:0crwdne1633:0",
"about_dialog_description": "crwdns1635:0crwdne1635:0",
"setup_page_title": "crwdns1637:0crwdne1637:0",
"setup_page_description": "crwdns1639:0crwdne1639:0",
"setup_page_create_account_title": "crwdns1641:0crwdne1641:0",
"setup_page_create_account_subtitle": "crwdns1643:0crwdne1643:0",
"setup_page_create_account_button": "crwdns1645:0crwdne1645:0",
"setup_page_create_restore_title": "crwdns1647:0crwdne1647:0",
"setup_page_create_restore_subtitle": "crwdns1649:0crwdne1649:0",
"setup_page_create_restore_button": "crwdns1651:0crwdne1651:0",
"wallets_transfer": "crwdns1653:0crwdne1653:0",
"wallets_swap": "crwdns1655:0crwdne1655:0",
"wallets_red_packet": "crwdns1657:0crwdne1657:0",
"wallets_sell": "crwdns1659:0crwdne1659:0",
"wallets_history": "crwdns1661:0crwdne1661:0",
"settings": "crwdns1663:0crwdne1663:0",
"done": "crwdns1665:0crwdne1665:0",
"labs": "crwdns1667:0crwdne1667:0",
"wallets_startup_create": "crwdns1669:0crwdne1669:0",
"wallets_startup_create_desc": "crwdns1671:0crwdne1671:0",
"wallets_startup_create_action": "crwdns1673:0crwdne1673:0",
"wallets_startup_import": "crwdns1675:0crwdne1675:0",
"wallets_startup_import_desc": "crwdns1677:0crwdne1677:0",
"wallets_startup_import_action": "crwdns1679:0crwdne1679:0",
"wallets_startup_connect": "crwdns1681:0crwdne1681:0",
"wallets_startup_connect_desc": "crwdns1683:0crwdne1683:0",
"wallets_startup_connect_action": "crwdns1685:0crwdne1685:0",
"wallets_connect_wallet_metamask": "crwdns1687:0crwdne1687:0",
"wallets_connect_wallet_connect": "crwdns1689:0crwdne1689:0",
"wallets_connect_wallet_polka": "crwdns1691:0crwdne1691:0",
"wallets_create_wallet_input_placeholder": "crwdns1693:0crwdne1693:0",
"wallets_create_successfully_title": "crwdns1695:0crwdne1695:0",
"wallets_create_successfully_tips": "crwdns1697:0crwdne1697:0",
"wallets_create_successfully_unlock": "crwdns1699:0crwdne1699:0",
"wallets_create_wallet_alert": "crwdns1701:0crwdne1701:0",
"wallets_wallet_connect_title": "crwdns1703:0crwdne1703:0",
"wallets_wallet_mnemonic": "crwdns1705:0crwdne1705:0",
"wallets_wallet_json_file": "crwdns1707:0crwdne1707:0",
"wallets_wallet_private_key": "crwdns1709:0crwdne1709:0",
"wallets_import_wallet_tabs": "crwdns1711:0crwdne1711:0",
"wallets_import_wallet_password_placeholder": "crwdns1713:0crwdne1713:0",
"wallets_import_wallet_cancel": "crwdns1715:0crwdne1715:0",
"wallets_import_wallet_import": "crwdns1717:0crwdne1717:0",
"wallets_create_wallet_tabs": "crwdns1719:0crwdne1719:0",
"wallets_create_wallet_refresh": "crwdns1721:0crwdne1721:0",
"wallets_create_wallet_remember_later": "crwdns1723:0crwdne1723:0",
"wallets_create_wallet_verification": "crwdns1725:0crwdne1725:0",
"wallets_collectible_address": "crwdns1727:0crwdne1727:0",
"wallets_balance": "crwdns1729:0crwdne1729:0",
"wallets_balance_Send": "crwdns1731:0crwdne1731:0",
"wallets_balance_Buy": "crwdns1733:0crwdne1733:0",
"wallets_balance_Swap": "crwdns1735:0crwdne1735:0",
"wallets_balance_Receive": "crwdns1737:0crwdne1737:0",
"wallets_assets_token": "crwdns1739:0crwdne1739:0",
"wallets_assets_investment": "crwdns1741:0crwdne1741:0",
"wallets_assets_collections": "crwdns1743:0crwdne1743:0",
"wallets_assets_custom_token": "crwdns1745:0crwdne1745:0",
"wallets_assets_custom_collectible": "crwdns1747:0crwdne1747:0",
"wallets_assets_asset": "crwdns1749:0crwdne1749:0",
"wallets_assets_balance": "crwdns1751:0crwdne1751:0",
"wallets_assets_price": "crwdns1753:0crwdne1753:0",
"wallets_assets_value": "crwdns1755:0crwdne1755:0",
"wallets_assets_operation": "crwdns1757:0crwdne1757:0",
"wallets_address": "crwdns1759:0crwdne1759:0",
"wallets_receive_tips": "crwdns1761:0{{chainName}}crwdne1761:0",
"wallets_add_collectible": "crwdns1763:0crwdne1763:0",
"wallets_incorrect_address": "crwdns1765:0crwdne1765:0",
"wallets_collectible_been_added": "crwdns1767:0crwdne1767:0",
"wallets_collectible_add": "crwdns1769:0crwdne1769:0",
"wallets_add_token": "crwdns1771:0crwdne1771:0",
"wallets_token_been_added": "crwdns1773:0crwdne1773:0",
"wallets_token_symbol_tips": "crwdns1775:0crwdne1775:0",
"wallets_token_decimals_tips": "crwdns1777:0crwdne1777:0",
"wallets_add_token_contract_address": "crwdns1779:0crwdne1779:0",
"wallets_add_token_symbol": "crwdns1781:0crwdne1781:0",
"wallets_add_token_decimals": "crwdns1783:0crwdne1783:0",
"wallets_add_token_cancel": "crwdns1785:0crwdne1785:0",
"wallets_add_token_next": "crwdns1787:0crwdne1787:0",
"wallets_empty_tokens_tip": "crwdns1789:0crwdne1789:0",
"wallets_empty_collectible_tip": "crwdns1791:0crwdne1791:0",
"wallets_address_copied": "crwdns1793:0crwdne1793:0",
"wallets_address_copy": "crwdns1795:0crwdne1795:0",
"wallets_history_types": "crwdns1797:0crwdne1797:0",
"wallets_history_value": "crwdns1799:0crwdne1799:0",
"wallets_history_time": "crwdns1801:0crwdne1801:0",
"wallets_history_receiver": "crwdns1803:0crwdne1803:0",
"wallets_empty_history_tips": "crwdns1805:0crwdne1805:0",
"wallets_loading_token": "crwdns1807:0crwdne1807:0",
"personas_setup_connect_tips": "crwdns1809:0{{type}}crwdne1809:0",
"personas_setup_connect": "crwdns1811:0crwdne1811:0",
"personas_name_maximum_tips": "crwdns1813:0{{length}}crwdne1813:0",
"personas_rename_placeholder": "crwdns1815:0crwdne1815:0",
"personas_confirm": "crwdns1817:0crwdne1817:0",
"personas_cancel": "crwdns1819:0crwdne1819:0",
"personas_delete_confirm_tips": "crwdns1821:0{{nickname}}crwdne1821:0",
"personas_delete_dialog_title": "crwdns1823:0crwdne1823:0",
"personas_edit_dialog_title": "crwdns1825:0crwdne1825:0",
"personas_edit": "crwdns1827:0crwdne1827:0",
"personas_delete": "crwdns1829:0crwdne1829:0",
"personas_add_persona": "crwdns1831:0crwdne1831:0",
"personas_back_up": "crwdns1833:0crwdne1833:0",
"personas_connect_to": "crwdns1835:0{{internalName}}crwdne1835:0",
"personas_disconnect": "crwdns1837:0crwdne1837:0",
"personas_rename": "crwdns1839:0crwdne1839:0",
"settings_general": "crwdns1841:0crwdne1841:0",
"settings_database_management": "crwdns1843:0crwdne1843:0",
"settings_profile": "crwdns1845:0crwdne1845:0",
"settings_language_title": "crwdns1847:0crwdne1847:0",
"settings_language_desc": "crwdns1849:0crwdne1849:0",
"settings_appearance_title": "crwdns1851:0crwdne1851:0",
"settings_appearance_desc": "crwdns1853:0crwdne1853:0",
"settings_data_source_title": "crwdns1855:0crwdne1855:0",
"settings_data_source_desc": "crwdns1857:0crwdne1857:0",
"settings_sync_with_mobile_title": "crwdns1859:0crwdne1859:0",
"settings_sync_with_mobile_desc": "crwdns1861:0crwdne1861:0",
"settings_global_backup_title": "crwdns1863:0crwdne1863:0",
"settings_global_backup_desc": "crwdns1865:0crwdne1865:0",
"settings_restore_database_title": "crwdns1867:0crwdne1867:0",
"settings_restore_database_desc": "crwdns1869:0crwdne1869:0",
"settigns_email_title": "crwdns1871:0crwdne1871:0",
"settings_change_passowrd_title": "crwdns1873:0crwdne1873:0",
"settings_change_passowrd_desc": "crwdns1875:0crwdne1875:0",
"settings_email_hosting_service_title": "crwdns1877:0crwdne1877:0",
"settings_email_hosting_service_desc": "crwdns1879:0crwdne1879:0",
"settings_log_out_title": "crwdns1881:0crwdne1881:0",
"settings_log_out_desc": "crwdns1883:0crwdne1883:0",
"labs_file_service": "crwdns1885:0crwdne1885:0",
"labs_file_service_desc": "crwdns1887:0crwdne1887:0",
"labs_markets": "crwdns1889:0crwdne1889:0",
"labs_markets_desc": "crwdns1891:0crwdne1891:0",
"labs_red_packet": "crwdns1893:0crwdne1893:0",
"labs_red_packet_desc": "crwdns1895:0crwdne1895:0",
"labs_swap": "crwdns1897:0crwdne1897:0",
"labs_swap_desc": "crwdns1899:0crwdne1899:0",
"labs_transak": "crwdns1901:0crwdne1901:0",
"labs_transak_desc": "crwdns1903:0crwdne1903:0",
"labs_snapshot": "crwdns1905:0crwdne1905:0",
"labs_snapshot_desc": "crwdns1907:0crwdne1907:0",
"labs_market_trend": "crwdns1909:0crwdne1909:0",
"labs_market_trend_desc": "crwdns1911:0crwdne1911:0",
"labs_collectibles": "crwdns1913:0crwdne1913:0",
"labs_collectibles_desc": "crwdns1915:0crwdne1915:0",
"labs_gitcoin": "crwdns1917:0crwdne1917:0",
"labs_gitcoin_desc": "crwdns1919:0crwdne1919:0",
"labs_valuables": "crwdns1921:0crwdne1921:0",
"labs_valuables_desc": "crwdns1923:0crwdne1923:0",
"labs_dhedge": "crwdns1925:0crwdne1925:0",
"labs_dhedge_desc": "crwdns1927:0crwdne1927:0",
"labs_settings_market_trend": "crwdns1929:0crwdne1929:0",
"labs_settings_market_trend_source": "crwdns1931:0crwdne1931:0",
"labs_settings_swap": "crwdns1933:0crwdne1933:0",
"labs_settings_swap_eth": "crwdns1935:0crwdne1935:0",
"labs_settings_swap_polygon": "crwdns1937:0crwdne1937:0",
"labs_settings_swap_bsc": "crwdns1939:0crwdne1939:0",
"dashboard_mobile_test": "crwdns1941:0crwdne1941:0",
"dashboard_source_code": "crwdns1943:0crwdne1943:0",
"privacy_policy": "crwdns1945:0crwdne1945:0",
"version_of_stable": "crwdns1947:0{{version}}crwdne1947:0",
"version_of_unstable": "crwdns1949:0{{version}}crwdnd1949:0{{build}}crwdnd1949:0{{hash}}crwdne1949:0",
"register_restore_backups": "crwdns1951:0crwdne1951:0",
"register_restore_backups_cancel": "crwdns1953:0crwdne1953:0",
"register_restore_backups_confirm": "crwdns1955:0crwdne1955:0",
"register_restore_backups_hint": "crwdns1957:0crwdne1957:0",
"register_restore_backups_file": "crwdns1959:0crwdne1959:0",
"register_restore_backups_text": "crwdns1961:0crwdne1961:0",
"register_restore_backups_tabs": "crwdns1963:0crwdne1963:0"
}
1 change: 1 addition & 0 deletions packages/dashboard/src/locales/zh-CN.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import { useAsyncFn } from 'react-use'
import { Services } from '../../../API'
import type { ProfileIdentifier } from '@masknet/shared'
import type { AsyncFnReturn } from 'react-use/lib/useAsyncFn'

export function useConnectSocialNetwork() {
return useAsyncFn(Services.SocialNetwork.connectSocialNetwork)
}

export function useDisconnectSocialNetwork() {
export function useDisconnectSocialNetwork(): AsyncFnReturn<(identifier: ProfileIdentifier) => Promise<void>> {
return useAsyncFn((identifier: ProfileIdentifier) => Services.Identity.detachProfile(identifier))
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { useAsyncFn } from 'react-use'
import { Messages, Services } from '../../../API'
import { delay } from '@masknet/shared'
import type { AsyncFnReturn } from 'react-use/lib/useAsyncFn'

export function useCreatePersona() {
export function useCreatePersona(): AsyncFnReturn<(nickName: string) => Promise<void>> {
return useAsyncFn(async (nickName: string) => {
// TODO: should second parameter be the password?
const identifier = await Services.Identity.createPersonaByMnemonic(nickName, '')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,24 @@ import { MenuItem } from '@material-ui/core'
import { useLanguage } from '../api'
import { Services } from '../../../API'
import SettingSelect from './SettingSelect'
import { Language } from '@masknet/theme'
import { LanguageOptions } from '@masknet/theme'
import { useDashboardI18N } from '../../../locales'

export default function LanguageSetting() {
const lang = useLanguage()
const handleChange = (event: any) => {
Services.Settings.setLanguage(event.target.value)
}
const t = useDashboardI18N()

return (
<SettingSelect value={lang} onChange={handleChange}>
<MenuItem value={Language.zh}>中文</MenuItem>
<MenuItem value={Language.en}>English</MenuItem>
<MenuItem value={Language.ko}>한국인</MenuItem>
<MenuItem value={Language.ja}>日本語</MenuItem>
<MenuItem value={LanguageOptions.__auto__}>{t.settings_language_auto()}</MenuItem>
<MenuItem value={LanguageOptions.enUS}>English</MenuItem>
<MenuItem value={LanguageOptions.zhCN}>简体中文</MenuItem>
<MenuItem value={LanguageOptions.zhTW}>正體中文</MenuItem>
<MenuItem value={LanguageOptions.jaJP}>日本語</MenuItem>
<MenuItem value={LanguageOptions.koKR}>한국인</MenuItem>
</SettingSelect>
)
}
1 change: 1 addition & 0 deletions packages/maskbook/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@
"fuse.js": "^6.4.3",
"gun": "0.2020.520",
"https-browserify": "^1.0.0",
"i18next-browser-languagedetector": "^6.1.2",
"immer": "^9.0.5",
"isomorphic-dompurify": "^0.13.0",
"jsbi": "3.1.4",
Expand Down
Loading

0 comments on commit 1be35d8

Please sign in to comment.