From 930e89a200db4931af018a6c35f9383820cf1809 Mon Sep 17 00:00:00 2001 From: midare Date: Tue, 26 Mar 2019 19:36:35 +0800 Subject: [PATCH] feat: add zh-hant language --- .gitignore | 3 +++ ...BUTING-zh_CN.md => CONTRIBUTING-zh-Hans.md | 0 CONTRIBUTING.md | 2 +- README-ja_JP.md => README-ja.md | 2 +- README-zh_CN.md => README-zh-Hans.md | 8 ++++---- README.md | 2 +- .../{README-zh_CN.md => README-zh-Hans.md} | 0 packages/griffith-message/README.md | 16 +++++++-------- .../{README-zh_CN.md => README-zh-Hans.md} | 0 packages/griffith-standalone/README.md | 2 +- .../{README-zh_CN.md => README-zh-Hans.md} | 2 +- packages/griffith/README.md | 4 ++-- packages/griffith/index.d.ts | 2 +- .../src/components/TranslatedText/strings.js | 20 ++++++++++++++++++- 14 files changed, 42 insertions(+), 21 deletions(-) rename CONTRIBUTING-zh_CN.md => CONTRIBUTING-zh-Hans.md (100%) rename README-ja_JP.md => README-ja.md (98%) rename README-zh_CN.md => README-zh-Hans.md (93%) rename packages/griffith-message/{README-zh_CN.md => README-zh-Hans.md} (100%) rename packages/griffith-standalone/{README-zh_CN.md => README-zh-Hans.md} (100%) rename packages/griffith/{README-zh_CN.md => README-zh-Hans.md} (98%) diff --git a/.gitignore b/.gitignore index 3071c312..232d887f 100644 --- a/.gitignore +++ b/.gitignore @@ -10,3 +10,6 @@ package-lock.json .eslintcache *.log .DS_Store + +# Editor +.vscode diff --git a/CONTRIBUTING-zh_CN.md b/CONTRIBUTING-zh-Hans.md similarity index 100% rename from CONTRIBUTING-zh_CN.md rename to CONTRIBUTING-zh-Hans.md diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 4828116a..36150233 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,4 +1,4 @@ -English | [简体中文](./CONTRIBUTING-zh_CN.md) +English | [简体中文](./CONTRIBUTING-zh-Hans.md) # How to Contribute diff --git a/README-ja_JP.md b/README-ja.md similarity index 98% rename from README-ja_JP.md rename to README-ja.md index a85b2187..a344d39d 100644 --- a/README-ja_JP.md +++ b/README-ja.md @@ -10,7 +10,7 @@ ![Code style](https://img.shields.io/badge/code_style-prettier-ff69b4.svg) [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](https://github.com/zhihu/griffith/blob/master/CONTRIBUTING.md) -[English](./README.md) | [简体中文](./README-zh_CN.md) | [日本語](./README-ja_JP.md) +[English](./README.md) | [简体中文](./README-zh-Hans.md) | [日本語](./README-ja.md) # はじめに diff --git a/README-zh_CN.md b/README-zh-Hans.md similarity index 93% rename from README-zh_CN.md rename to README-zh-Hans.md index cdab736e..a693b17e 100644 --- a/README-zh_CN.md +++ b/README-zh-Hans.md @@ -10,7 +10,7 @@ ![Code style](https://img.shields.io/badge/code_style-prettier-ff69b4.svg) [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](https://github.com/zhihu/griffith/blob/master/CONTRIBUTING.md) -[English](./README.md) | [简体中文](./README-zh_CN.md) | [日本語](./README-ja_JP.md) +[English](./README.md) | [简体中文](./README-zh-Hans.md) | [日本語](./README-ja.md) ## 简介 @@ -45,7 +45,7 @@ const sources = { render() ``` -[查看详细使用方法](./packages/griffith/README-zh_CN.md) +[查看详细使用方法](./packages/griffith/README-zh-Hans.md) **注意:暂不支持 SSR 应用** @@ -68,7 +68,7 @@ const sources = { Griffith.createPlayer(element).render({sources}) ``` -[查看 Standalone 模式详细使用方法](./packages/griffith-standalone/README-zh_CN.md) +[查看 Standalone 模式详细使用方法](./packages/griffith-standalone/README-zh-Hans.md) ## 项目结构 @@ -120,7 +120,7 @@ module.exports = { ### 贡献指南 -查看我们的[贡献指南](./CONTRIBUTING-zh_CN.md)来了解我们的开发流程。 +查看我们的[贡献指南](./CONTRIBUTING-zh-Hans.md)来了解我们的开发流程。 ### 贡献者 diff --git a/README.md b/README.md index 0b924a9c..9d9be6ae 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ ![Code style](https://img.shields.io/badge/code_style-prettier-ff69b4.svg) [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](https://github.com/zhihu/griffith/blob/master/CONTRIBUTING.md) -[English](./README.md) | [简体中文](./README-zh_CN.md) | [日本語](./README-ja_JP.md) +[English](./README.md) | [简体中文](./README-zh-Hans.md) | [日本語](./README-ja.md) # Introduction diff --git a/packages/griffith-message/README-zh_CN.md b/packages/griffith-message/README-zh-Hans.md similarity index 100% rename from packages/griffith-message/README-zh_CN.md rename to packages/griffith-message/README-zh-Hans.md diff --git a/packages/griffith-message/README.md b/packages/griffith-message/README.md index 5223b9bf..f3b2bb9f 100644 --- a/packages/griffith-message/README.md +++ b/packages/griffith-message/README.md @@ -1,6 +1,6 @@ # griffith-message -English | [简体中文](./README-zh_CN.md) +English | [简体中文](./README-zh-Hans.md) Griffith message communication plugin @@ -92,10 +92,10 @@ Events received from the player Event sent to the player -| `messageName` | Description | `data` | Status | -| --------------------------------- | ---------------- | ----------------------------------------------------------- | ------ | -| `ACTIONS.PLAYER.PLAY` | Play | `{applyOnFullScreen: boolean}` Applied to full screen video | TODO | -| `ACTIONS.PLAYER.PAUSE` | Pause | Applied to full screen video | ✅ | -| `ACTIONS.PLAYER.SET_VOLUME` | Set the volume | `{volume: number}` Volume value from 0 to 1 | TODO | -| `ACTIONS.PLAYER.ENTER_FULLSCREEN` | Enter fullScreen | null | TODO | -| `ACTIONS.PLAYER.EXIT_FULLSCREEN` | Exit fullscreen | null | TODO | +| `messageName` | Description | `data` | Status | +| --------------------------------- | ---------------- | ----------------------------------------------------------- | --------- | +| `ACTIONS.PLAYER.PLAY` | Play | `{applyOnFullScreen: boolean}` Applied to full screen video | TODO | +| `ACTIONS.PLAYER.PAUSE` | Pause | Applied to full screen video | SUPPORTED | +| `ACTIONS.PLAYER.SET_VOLUME` | Set the volume | `{volume: number}` Volume value from 0 to 1 | TODO | +| `ACTIONS.PLAYER.ENTER_FULLSCREEN` | Enter fullScreen | null | TODO | +| `ACTIONS.PLAYER.EXIT_FULLSCREEN` | Exit fullscreen | null | TODO | diff --git a/packages/griffith-standalone/README-zh_CN.md b/packages/griffith-standalone/README-zh-Hans.md similarity index 100% rename from packages/griffith-standalone/README-zh_CN.md rename to packages/griffith-standalone/README-zh-Hans.md diff --git a/packages/griffith-standalone/README.md b/packages/griffith-standalone/README.md index 7295caec..f981aa7e 100644 --- a/packages/griffith-standalone/README.md +++ b/packages/griffith-standalone/README.md @@ -1,6 +1,6 @@ # griffith-standalone -English | [简体中文](./README-zh_CN.md) +English | [简体中文](./README-zh-Hans.md) Griffith bundled with React, React DOM and other dependencies. You can use it by add a `script` tag in your HTML file. diff --git a/packages/griffith/README-zh_CN.md b/packages/griffith/README-zh-Hans.md similarity index 98% rename from packages/griffith/README-zh_CN.md rename to packages/griffith/README-zh-Hans.md index 0205f88d..6251bc14 100644 --- a/packages/griffith/README-zh_CN.md +++ b/packages/griffith/README-zh-Hans.md @@ -29,7 +29,7 @@ render() | `shouldObserveResize` | `boolean` | `false` | 是否监听窗口 resize | | `initialObjectFit` | `fill \| \contain \| cover \| none \| scale-down` | `contain` | object-fit 参数 | | `useMSE` | `boolean` | `false` | 是否启用 MSE | -| `locale` | `en \| zh_cn` | `en` | 界面语言 | +| `locale` | `en \| ja \| zh-Hans \| zh-Hant` | `en` | 界面语言 | `sources` 字段: diff --git a/packages/griffith/README.md b/packages/griffith/README.md index 258b5209..9a5cb2fb 100644 --- a/packages/griffith/README.md +++ b/packages/griffith/README.md @@ -1,6 +1,6 @@ # griffith -English | [简体中文](./README-zh_CN.md) +English | [简体中文](./README-zh-Hans.md) ## Usage @@ -30,7 +30,7 @@ render() | `shouldObserveResize` | `boolean` | `false` | Listen to the window resize | | `initialObjectFit` | `fill \| contain \| cover \| none \| scale-down` | `contain` | object-fit | | `useMSE` | `boolean` | `false` | Enable Media Source Extensions™ | -| `locale` | `en \| zh_cn` | `en` | UI Locale | +| `locale` | `en \| ja \| zh-Hans \| zh-Hant` | `en` | UI Locale | `sources`: diff --git a/packages/griffith/index.d.ts b/packages/griffith/index.d.ts index e4803113..53a8cf97 100644 --- a/packages/griffith/index.d.ts +++ b/packages/griffith/index.d.ts @@ -26,7 +26,7 @@ interface PlayerContainerProps { shouldObserveResize?: boolean initialObjectFit?: 'fill' | 'contain' | 'cover' | 'none' | 'scale-down' useMSE?: boolean - locale?: 'en' | 'zh_cn' + locale?: 'en' | 'ja' | 'zh-Hans' | 'zh-Hant' } interface Subscription { diff --git a/packages/griffith/src/components/TranslatedText/strings.js b/packages/griffith/src/components/TranslatedText/strings.js index f2282468..716a5cf0 100644 --- a/packages/griffith/src/components/TranslatedText/strings.js +++ b/packages/griffith/src/components/TranslatedText/strings.js @@ -7,7 +7,16 @@ export default { 'action-enter-fullscreen': 'Fullscreen', 'action-exit-fullscreen': 'Exit Fullscreen', }, - zh_cn: { + ja: { + 'quality-auto': '自動', + 'quality-ld': '低画質', + 'quality-sd': '標準画質', + 'quality-hd': '高画質', + 'action-enter-fullscreen': '全画面', + 'action-exit-fullscreen': '全画面終了', + }, + // covers zh-Hans-CN and zh-Hans-SG + 'zh-Hans': { 'quality-auto': '自动', 'quality-ld': '低清', 'quality-sd': '标清', @@ -15,4 +24,13 @@ export default { 'action-enter-fullscreen': '全屏', 'action-exit-fullscreen': '退出全屏', }, + // covers zh-Hant-HK and zh-Hant-TW + 'zh-Hant': { + 'quality-auto': '自動', + 'quality-ld': '低畫質', + 'quality-sd': '標準畫質', + 'quality-hd': '高畫質', + 'action-enter-fullscreen': '全螢幕', + 'action-exit-fullscreen': '結束全螢幕', + }, }