Skip to content

Commit 3e4e537

Browse files
committed
Add documentation for translations
1 parent 4af452a commit 3e4e537

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

contributing.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ If these doesn't answer your question
1111
* Use [our Slack](https://bit.ly/plyr-chat) if you need help using Plyr or have questions about Plyr.
1212

1313
## Commenting
14+
1415
When commenting, keep a civil tone and stay on topic. Don't ask for [support](#support), or post "+1" or "I agree" type of comments. Use the emojis instead.
1516

1617
Asking for the status on issues is discouraged. Unless someone has explicitly said in an issue that it's work in progress, most likely that means no one is working on it. We have a lot to do, and it may not be a top priority for us.
@@ -38,3 +39,15 @@ Please follow the instructions in our issue templates. Don't use github issues t
3839
* When finished, push the changes to your GitHub repository and send a pull request to **develop**. Describe what your PR does.
3940

4041
* If the Travis build fails, or if you get a code review with change requests, you can fix these by pushing new or rebased commits to the branch.
42+
43+
## Contributing translations
44+
45+
* Fork Plyr, and create a new branch in your fork, based on the **develop** branch
46+
47+
* Make and translate language file `src/locales/{lang}.js`, where `{lang}` is two-letter language code from [ISO 639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes). It is recommended to copy and edit English translation.
48+
49+
* Add your language to `src/locales/index.js`. Make sure to import your file and follow the file format. The entry `name` should be native name of language.
50+
51+
* Test your changes.
52+
53+
* When finished, commit and push the changes to your GitHub repository and send a pull request to **develop**.

readme.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@ A simple, lightweight, accessible and customizable HTML5, YouTube and Vimeo medi
2121
- **[Events](#events)** - no messing around with Vimeo and YouTube APIs, all events are standardized across formats
2222
- **[Fullscreen](#fullscreen)** - supports native fullscreen with fallback to "full window" modes
2323
- **[Shortcuts](#shortcuts)** - supports keyboard shortcuts
24+
- **[Internationalization (i18n)](#internationalization)** - supports internationalization of controls
2425
- **Picture-in-Picture** - supports Safari's picture-in-picture mode
2526
- **Playsinline** - supports the `playsinline` attribute
2627
- **Speed controls** - adjust speed on the fly
2728
- **Multiple captions** - support for multiple caption tracks
28-
- **i18n support** - support for internationalization of controls
2929
- **No dependencies** - written in "vanilla" ES6 JavaScript, no jQuery required
3030
- **SASS** - to include in your build processes
3131

@@ -286,6 +286,7 @@ Note the single quotes encapsulating the JSON and double quotes on the object ke
286286
| `debug` | Boolean | `false` | Display debugging information in the console |
287287
| `controls` | Array, Function or Element | `['play-large', 'play', 'progress', 'current-time', 'mute', 'volume', 'captions', 'settings', 'pip', 'airplay', 'fullscreen']` | If a function is passed, it is assumed your method will return either an element or HTML string for the controls. Three arguments will be passed to your function; `id` (the unique id for the player), `seektime` (the seektime step in seconds), and `title` (the media title). See [controls.md](controls.md) for more info on how the html needs to be structured. |
288288
| `settings` | Array | `['captions', 'quality', 'speed', 'loop']` | If you're using the default controls are used then you can specify which settings to show in the menu |
289+
| `language` | String | `en` | Language code (ISO 639-1) for UI internationalization. |
289290
| `i18n` | Object | See [defaults.js](/src/js/config/defaults.js) | Used for internationalization (i18n) of the text within the UI. |
290291
| `loadSprite` | Boolean | `true` | Load the SVG sprite specified as the `iconUrl` option (if a URL). If `false`, it is assumed you are handling sprite loading yourself. |
291292
| `iconUrl` | String | `null` | Specify a URL or path to the SVG sprite. See the [SVG section](#svg) for more info. |
@@ -619,6 +620,12 @@ document then the shortcuts will work when any element has focus, apart from an
619620

620621
Fullscreen in Plyr is supported by all browsers that [currently support it](http://caniuse.com/#feat=fullscreen).
621622

623+
## Internationalization
624+
625+
Internationalization (i18n) language could be specified with `language` option. It will translate all controls in Plyr. If the language is not specified, it will default to English.
626+
627+
If you want custom internationalization values, you should specify them to `i18n` option.
628+
622629
## Browser support
623630

624631
Plyr supports the last 2 versions of most _modern_ browsers.

0 commit comments

Comments
 (0)