Skip to content
This repository was archived by the owner on Mar 22, 2020. It is now read-only.

Commit 57d41de

Browse files
committed
refactor
1 parent 781eb80 commit 57d41de

33 files changed

Lines changed: 1044 additions & 208 deletions

MAINTAINER.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
2+
# Maintainer tips
3+
4+
Congratulations! You're a maintainer of the translation.
5+
6+
We setup some things for you.
7+
8+
1. There's a team `translate-<lang-code>` that includes all maintainers.
9+
- You can add people there by making a PR to `langs/<lang-code>.json`.
10+
- You can notify all translators by mentioning the team, e.g. `@translate-en`.
11+
12+
2. Guess, you want other people to join you?
13+
-
14+
15+
## Working with others
16+
17+
2. There's an issue to track translation progress.
18+
19+
- When a non-maintainer would like to translate an article:
20+
- They should create a separate issue.
21+
- And you label it in the issue.
22+
-

Readme.md

Lines changed: 59 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,64 @@
1-
# Translation percentage calculator
1+
# Translation of the Modern JavaScript Tutorial
22

3-
Checks out / updates repos listed at https://github.com/iliakan/javascript-tutorial-en.
3+
This repo hosts tools to translate the Modern JavaScript Tutorial <https://javascript.info>.
44

5-
For each repo, compares it vs en version.
5+
| Language | Github | Translated (%) | &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Last&nbsp;Commit&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; | Published |
6+
|----------|--------|----------------|------------------------------------------------------------------------------------------|-----------|
7+
| Chinese | [Contribute](https://github.com/javascript-tutorial/zh.javascript.info) | ![](http://translate.javascript.info/translate/zh.svg) | ![](https://img.shields.io/github/last-commit/javascript-tutorial/zh.javascript.info.svg?maxAge=900&label=) | [zh.javascript.info](https://zh.javascript.info) |
8+
| Japanese | [Contribute](https://github.com/javascript-tutorial/ja.javascript.info) | ![](http://translate.javascript.info/translate/ja.svg) | ![](https://img.shields.io/github/last-commit/javascript-tutorial/ja.javascript.info.svg?maxAge=900&label=) | [ja.javascript.info](https://ja.javascript.info) |
9+
| Russian | [Contribute](https://github.com/javascript-tutorial/ru.javascript.info) | ![](http://translate.javascript.info/translate/ru.svg) | ![](https://img.shields.io/github/last-commit/javascript-tutorial/ru.javascript.info.svg?maxAge=900&label=) | [ru.javascript.info](https://ru.javascript.info) |
610

7-
The comparison is as follows (`countTranslation.js`):
11+
## Starting a new translation
812

9-
1. For each `.md` file in the en version.
10-
2. If there exists the same file and it's different enough (jsdiff), it's considered translated.
11-
3. Then translated count / total files count = percentage.
13+
If you would like to be the maintainer of a new translation, submit a PR adding a new file `{lang-code}.json`
14+
to the `langs` folder with the following information:
1215

16+
* [Language code](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes)
17+
* List of maintainers
18+
19+
For example:
20+
21+
```json
22+
{
23+
"name": "English",
24+
"code": "en",
25+
"maintainers": ["iliakan", "lex111"]
26+
}
27+
```
28+
29+
30+
As a maintainer:
31+
32+
- You should know JavaScript well enough to translate and review pull requests of others.
33+
34+
Once the PR is accepted, we will:
35+
36+
* Create a new repository for you at `javascript-tutorial/{lang-code}.javascript.info`.
37+
* Add/invite all maintainers to the team `translate-{lang-code}` in the javascript-tutorial organization.
38+
* Create an special issue in the new repository to track your translation progress.
39+
40+
If you are not a member of the organization, you should receive an email invite to join. Please accept this invite so you can get admin access to your repository!
41+
42+
You may want to [pin](https://help.github.com/articles/pinning-an-issue-to-your-repository/) the generated issue to make it easier to find.
43+
44+
See [Maintainer Tips](/MAINTAINER.md) for additional advice on how to manage your repository.
45+
46+
Happy translating!
47+
48+
49+
## Adding a maintainer
50+
51+
If you are currently a maintainer of a translation and want to add another member, send a pull request to this repo updating `langs/{lang-code}.json`, where `{lang-code}` is the language code of the repo you want to be a maintainer of.
52+
53+
If you are interested in becoming a maintainer for a translation, please ask one of the current maintainers if they would like to add you. While different maintainers can have different requirements, usually they look for people who have already contributed to the translation already, either by translating or reviewing.
54+
55+
## Before publishing
56+
57+
1. Review your translations and make sure that the pages listed in "Core Pages" are fully translated. Run the site yourself locally to make sure there are no bugs or missing translations.
58+
2. ask {TBD} to add {lang-code}.reactjs.org as a subdomain.
59+
3. submit a PR to [reactjs/reactjs.org](https://github.com/reactjs/reactjs.org) adding the language in the dropdown (once we make it).
60+
4. Celebrate! 🎉🌐
61+
62+
## Acknowledgements
63+
64+
The syncing scripts and the translation bot are based off of and iterated upon [react.org-translation](https://github.com/reactjs/reactjs.org-translation) by @tesseralis.

bin/clean.js

Lines changed: 0 additions & 6 deletions
This file was deleted.

bin/server.js

Lines changed: 0 additions & 4 deletions
This file was deleted.

config.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,12 @@ const config = {
44
projectRoot: process.cwd(),
55
cacheRoot: path.join(process.cwd(), 'cache'),
66
repoRoot: path.join(process.cwd(), 'repo'),
7-
secret: require('/js/secret.javascript-tutorial-stats')
7+
secret: require('/js/secret/translate'),
8+
owner: "iliakan",
9+
org: "javascript-tutorial",
10+
repoSuffix: "javascript.info",
11+
langMain: "en",
12+
teamMain: "translate"
813
};
914

1015
module.exports = config;

ecosystem.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@
99
"max_memory_restart": "2G",
1010
"kill_timeout": 5000,
1111
"wait_ready": true,
12-
"log_file": "/var/log/node/javascript.log",
13-
"error_file": "/var/log/node/javascript-err.log",
14-
"out_file": "/var/log/node/javascript-out.log",
15-
"cwd": "/js/javascript-tutorial-stats",
12+
"log_file": "/var/log/node/translate.log",
13+
"error_file": "/var/log/node/translate-err.log",
14+
"out_file": "/var/log/node/translate-out.log",
15+
"cwd": "/js/translate",
1616
"env": {
1717
"HOST": "::",
1818
"PORT": "80",

githubEmailMap.json

Lines changed: 0 additions & 17 deletions
This file was deleted.

gulpfile.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
const gulp = require('gulp');
2+
3+
gulp.task('clean', require('./tasks/clean'));
4+
gulp.task('refresh', require('./tasks/refresh'));
5+
gulp.task('server', require('./tasks/server'));
6+
gulp.task('initTranslation', require('./tasks/initTranslation'));
7+
gulp.task('initReadme', require('./tasks/initReadme'));

handlers/contributors.js

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -67,23 +67,11 @@ exports.get = async function (ctx) {
6767
}
6868
}
6969

70-
/*
7170

72-
// iliakan@users.noreply.github.com join with main acc iliakan@gmail.com
73-
for(let authorEmail in emailToAuthor) {
74-
let author = emailToAuthor[authorEmail];
75-
if (author.user && author.user.login && !authorEmail.endsWith('@users.noreply.github.com')) {
76-
if (statsByAuthor[author.user.login + '@users.noreply.github.com'] && statsByAuthor[authorEmail]) {
77-
console.log("MATCH @", statsByAuthor[author.user.login + '@users.noreply.github.com'], emailToAuthor[author.user.login + '@users.noreply.github.com']);
78-
console.log("MATCH MAIN", statsByAuthor[authorEmail], author)
79-
}
80-
}
81-
}*/
82-
83-
// remote iliakan@gmail.com, don't count original content author
84-
// all source code has him as the author, that's a lot already
71+
// remove iliakan@gmail.com, the original content author
72+
// so that only translators' lines count
8573
if (lang !== 'en' && lang !== 'ru') {
86-
delete statsByAuthor['iliakan@gmail.com']; // (actually email below is used)
74+
delete statsByAuthor['iliakan@gmail.com'];
8775
}
8876

8977
let contributorsTotal = 0;

langs/en.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"name": "English",
3+
"code": "en",
4+
"maintainers": ["iliakan"],
5+
"published": "true"
6+
}

0 commit comments

Comments
 (0)