Permalink
Browse files

i18n Documentation (#3637)

  • Loading branch information...
1 parent 0131cc8 commit 883188ac4edc0530e6f6dd5a818b593522ebfdb5 @BenMcGarry BenMcGarry committed with erikdesjardins Nov 23, 2016
Showing with 17 additions and 6 deletions.
  1. +3 −0 README.md
  2. +6 −6 examples/module.js
  3. +8 −0 locales/locales/README.md
View
@@ -66,6 +66,7 @@ Thinking about contributing to RES? Awesome! We just ask that you follow a few s
- `lib/templates/`: RES templates
- `lib/utils/`: RES utilities
- `lib/vendor/`: RES vendor libraries
+ - `locales`: RES i18n translations
- `node/`: Node files
- `safari/`: Safari-specific RES files
- `tests/`: integration tests
@@ -181,6 +182,8 @@ See [`examples/module.js`](https://github.com/honestbleeps/Reddit-Enhancement-Su
Create a new `.js` file in `lib/modules`.
It will automatically be loaded when the build script is restarted.
+All modules must now have i18n implementations. Please see [here](https://github.com/honestbleeps/Reddit-Enhancement-Suite/blob/master/locales/locales/README.md) for details.
+
##### Inline image viewer hosts
Please be sure that they support [CORS](https://en.wikipedia.org/wiki/Cross-origin_resource_sharing) so the sites do not need to be added as additional permissions, which has caused [headaches in the past](https://www.reddit.com/r/Enhancement/comments/1jskcm/announcement_chrome_users_did_your_res_turn_off/).
View
@@ -2,11 +2,11 @@
import { Module } from '../core/module';
-export const module: Module<*> = new Module('moduleId');
+export const module: Module<*> = new Module('myModule');
-module.moduleName = 'Readable module name';
-module.category = 'CategoryName';
-module.description = 'This is my module!';
+module.moduleName = 'myModuleName'; // add the friendly name to locales/locales/en.js for i18n
+module.category = 'browsingCategory'; // categories from locales/locales/en.js
+module.description = 'myModuleDesc'; // i18n
module.options = {
// Any configurable options go here.
// Options must have a type and a value..
@@ -15,12 +15,12 @@ module.options = {
defaultMessage: {
type: 'text',
value: 'This is default text',
- description: 'Explanation of what this option is for',
+ description: 'myModuleDefaultMessageDesc', // i18n
},
doSpecialStuff: {
type: 'boolean',
value: false,
- description: 'Explanation of what this option is for',
+ description: 'myModuleDoSpecialStuffDesc', // i18n
},
};
@@ -7,3 +7,11 @@
## New strings
New strings should be added to `en.json` and only that file.
+
+## Translating Modules
+
+Currently only module names, categories and descriptions are translatable. Please see [this](https://github.com/honestbleeps/Reddit-Enhancement-Suite/blob/master/lib/modules/commentHidePersistor.js) module for an example of how it's implemented.
+
+These strings can be found in `en.json` which then translate to the English string. A list of categories can also be found near the top of `en.json`.
+
+Modules will be reviewed for i18n before merge.

0 comments on commit 883188a

Please sign in to comment.