add script to sync locale files; update readme; update contributing

This commit is contained in:
Kevin Lee 2020-08-20 15:06:58 -07:00
Родитель 7d1b629968
Коммит fcc401380b
4 изменённых файлов: 84 добавлений и 18 удалений

Просмотреть файл

@ -57,7 +57,7 @@ If you are a 3D artist and want to support what we're doing with Hubs, consider
Our documentation for Hubs is hosted on the [GitHub Hubs Wiki](https://github.com/mozilla/hubs/wiki) section of the project. The documentation for Spoke is hosted on the [GitHub Spoke Wiki](https://github.com/mozilla/spoke/wiki) For contributing corrections or additional pages for the Wiki, please file an issue as a suggestion in the corresponding repository with your proposed content and we will review it and add it to the wiki when all looks good!
### 🌐 Localization
Hubs is currently en-US only, but if you would like to work with us on localization efforts, submit a suggestion through the GitHub issues and we'll work with you from there.
If you would like to add/update a localization translation for Hubs, please see the [Localization README](src/assets/locales/README.md). Then, please submit a pull request with your new/updated localization changes.
### 🦆 General Help
We believe in the power of community (that's why we're building this, after all!) and know that not all forms of support will come from something outlined here. Feel free to jump into our public [Discord server](https://discord.gg/wHmY4nd) to chat with us and ask about how you can get involved!

Просмотреть файл

@ -1,10 +1,13 @@
# Adding Locales
# Localization
## Adding Locales
1. Copy an existing locale (e.g. [en.json](en.json)) to a new file using appropriate locale code as filename. (e.g. [zh.json](zh.json))
* For locales that have duplicate codes (e.g. `zh` and `zh-ch`), edit [locale_config.js](locale_config.js) to define the fallback locale so that the locale file doesn't need to be duplicated.
2. Edit your new locale file with your translations.
# Adding to existing Locales
## Adding to existing Locales
1. Add your new key and translation to [en.json](en.json).
2. Add the key and translation (either the same english translation from step 1, or the correct language equivalent if available, to the other locale files).
2. Run `node sync_locales.js` in this directory. This will sync any new keys and translations made in `en.json` to all the other locale files.
3. Update the other locale files with correct translations if available.

Просмотреть файл

@ -0,0 +1,41 @@
// this script syncs changes made in en.json to any other .json files found in this directory
const fs = require("fs");
const localeFiles = [];
fs.readdirSync(".").forEach(file => {
if (file.endsWith(".json") && file !== "en.json") {
localeFiles.push(file);
}
});
const raw_default_en = fs.readFileSync("en.json");
const parsed_default_en = JSON.parse(raw_default_en);
for (let i = 0; i < localeFiles.length; i++) {
const localeFile = localeFiles[i];
const raw_locale = fs.readFileSync(localeFile);
let parsed_locale = {};
try {
parsed_locale = JSON.parse(raw_locale);
} catch (e) {
console.log(`malformed json found, copying en.json completely to ${localeFile}.`);
fs.writeFileSync(localeFile, raw_default_en);
continue;
}
const output = {};
for (const key in parsed_default_en) {
if (parsed_locale[key]) {
output[key] = parsed_locale[key];
} else {
output[key] = parsed_default_en[key];
}
}
const stringified_output = JSON.stringify(output, null, 2);
fs.writeFileSync(localeFile, stringified_output);
console.log(`${localeFile} updated.`);
}

Просмотреть файл

@ -278,30 +278,42 @@
"commands.debug": "切换物理属性除错",
"commands.vrstats": "切换VR统计数据",
"commands.audiomode": "(实验的) 音频切换位置",
"preferences.closeButton": "Close Preferences Menu",
"preferences.selectCategory": "Select category",
"preferences.resetToDefault": "Reset preference to default",
"preferences.promptForRefresh": "Your preferences are saved, but some of your changes will not take effect until you refresh the page.",
"preferences.refreshNow": "Refresh Now",
"preferences.category_audio": "Audio",
"preferences.category_controls": "Controls",
"preferences.category_misc": "Misc",
"preferences.category_movement": "Movement",
"preferences.category_touchscreen": "Touchscreen",
"preferences.preferredCamera": "Preferred camera",
"preferences.muteMicOnEntry": "输入时静音麦克风",
"preferences.enableOnScreenJoystickLeft": "允许使用屏幕上左侧的操纵杆四处走动",
"preferences.enableOnScreenJoystickRight": "允许使用屏幕上右侧的操纵杆四处走动",
"preferences.onlyShowNametagsInFreeze": "当停止不动时只显示用户标签",
"preferences.animateWaypointTransitions": "Animate waypoint transitions",
"preferences.maxResolution": "最大分辨率 (宽 x 高 以像素为单位)",
"preferences.globalVoiceVolume": "传入的声音音量",
"preferences.globalMediaVolume": "媒体音量",
"preferences.disableSoundEffects": "停止音响效果",
"preferences.materialQualitySetting": "材质质量 (需要重启)",
"preferences.disableEchoCancellation": "禁用麦克风回音消除 (需要重启)",
"preferences.disableNoiseSuppression": "禁用麦克风噪声抑制 (需要重启)",
"preferences.disableAutoGainControl": "禁止麦克风自动获得控制权 (需要重启)",
"preferences.snapRotationDegrees": "每拍的旋转数 (角度)",
"preferences.allowMultipleHubsInstances": "当多个hubs打开时暂停自动离开功能",
"preferences.disableIdleDetection": "当没在使用或是后台运行时暂停自动离开功能",
"preferences.preferMobileObjectInfoPanel": "优先移动对象信息版面",
"preferences.baseMovementSpeed": "基础移送速度",
"preferences.disableMovement": "禁止移动",
"preferences.disableBackwardsMovement": "禁止向后运动",
"preferences.disableStrafing": "禁止扫射",
"preferences.disableTeleporter": "禁用传送点",
"preferences.movementSpeedModifier": "移动速度调整器",
"preferences.enableOnScreenJoystickLeft": "允许使用屏幕上左侧的操纵杆四处走动",
"preferences.enableOnScreenJoystickRight": "允许使用屏幕上右侧的操纵杆四处走动",
"preferences.invertTouchscreenCameraMove": "Invert direction of camera movement for touchscreens",
"preferences.onlyShowNametagsInFreeze": "当停止不动时只显示用户标签",
"preferences.animateWaypointTransitions": "Animate waypoint transitions",
"preferences.maxResolution": "最大分辨率 (宽 x 高 以像素为单位)",
"preferences.materialQualitySetting": "材质质量 (需要重启)",
"preferences.enableDynamicShadows": "Enable Dynamic Shadows",
"preferences.disableAutoPixelRatio": "禁用像素比例自动调整",
"preferences.disableEchoCancellation": "禁用麦克风回音消除 (需要重启)",
"preferences.disableNoiseSuppression": "禁用麦克风噪声抑制 (需要重启)",
"preferences.disableAutoGainControl": "禁止麦克风自动获得控制权 (需要重启)",
"preferences.allowMultipleHubsInstances": "当多个hubs打开时暂停自动离开功能",
"preferences.disableIdleDetection": "当没在使用或是后台运行时暂停自动离开功能",
"preferences.preferMobileObjectInfoPanel": "优先移动对象信息版面",
"settings.return-to-vr": "跳转到 VR虚拟现实",
"settings.change-avatar": "设置名字 & 头像",
"settings.change-scene": "选择一个场景",
@ -426,11 +438,21 @@
"tweet-dialog.close": "关闭",
"oauth-dialog.sign-in.twitter": "连接 Twitter",
"oauth-dialog.sign-in.discord": "登录 Discord",
"oauth-dialog.sign-in.slack": "Sign in to Slack",
"oauth-dialog.message.twitter": "连接 Twitter 从 %app-name% 发送 tweets",
"cloud.primary_tagline": "Hubs Cloud 部署私人服务器设施,\n可以通过你的电脑手机VR头盔\n进入到合作的3D房间.",
"cloud.secondary_tagline": "在 AWS Marketplace获得",
"cloud.call_to_action_personal": "获得私人 Hubs Cloud",
"cloud.call_to_action_enterprise": "获得企业 Hubs Cloud",
"cloud.aws_quick_start": "快速开始指南",
"cloud.splash_tag": "为你自己的 Hubs stack可配置的基础设施"
"cloud.splash_tag": "为你自己的 Hubs stack可配置的基础设施",
"support.missing-features": "Your browser is missing required features.",
"support.in-app-browser-ios": "Copy and paste this link directly into Safari",
"support.in-app-browser-android": "Copy and paste this link directly into Chrome or Firefox",
"support.update-browser": "Please try switching or updating to a newer browser",
"support.copy": "copy",
"support.copied": "copied!",
"support.details": "details",
"support.supported": "supported",
"support.unsupported": "unsupported"
}