Skip to content

Commit 248a4f4

Browse files
authored
Update README.md
1 parent 0226a11 commit 248a4f4

File tree

1 file changed

+28
-8
lines changed

1 file changed

+28
-8
lines changed

README.md

Lines changed: 28 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -116,15 +116,21 @@ Please note, the server must support that language. There must be corresponding
116116
117117
# Translating images
118118
119-
The text in SVG pictures can be translated as well.
119+
Please don't translate SVG files manually.
120120

121-
There's a special script for that. The translated strings should be in the `images.yml` file in the repository root, such as <https://github.com/javascript-tutorial/ru.javascript.info/blob/master/images.yml>. The script replaces strings in all svgs according to `images.yml`.
121+
They are auto-generated from the English variant, with the text phrases substituted from `images.yml` file in the repository root, such as <https://github.com/javascript-tutorial/ru.javascript.info/blob/master/images.yml>.
122+
123+
So you need to translate the content of `images.yml` and re-generate the SVGs using a script.
122124

123125
Here are the steps to translate images.
124126

125127
**Step 1.** Create `images.yml` with translations in the repository root.
126128

127-
The file format is "YAML", it's quite easy to understand:
129+
An example of such file (in Russian): https://github.com/javascript-tutorial/ru.javascript.info/blob/master/images.yml
130+
131+
The file format is "YAML".
132+
133+
Here's a quote:
128134
129135
```yaml
130136
code-style.svg: # image file name
@@ -133,28 +139,42 @@ code-style.svg: # image file name
133139
position: "center" # (optional) "center" or "right" - to position the translated string
134140
```
135141
136-
**Step 2.** Setup git upstream (if you haven't yet) and pull latest changes:
142+
As you can see, for each image file (such as `code-style.svg`), there go English phrases (such as `"No space"`).
143+
144+
For each phrase, there's the translated `text` and the text `position` (not always needed, details will come soon).
145+
146+
You can make a small file with only one image for the start.
147+
148+
**Step 2.** Setup git upstream (if you haven't yet) and pull latest changes from English version:
137149
138150
```bash
139151
cd /js/zh.javascript.info # in the tutorial folder
152+
140153
git remote add upstream https://github.com/javascript-tutorial/en.javascript.info
154+
141155
git fetch upstream master
142156
```
143157
144158
**Step 3.** Run the translation task:
159+
145160
```bash
146161
cd /js/server # in the server folder
162+
147163
# adjust NODE_LANG to your language
164+
148165
NODE_LANG=zh npm run gulp -- engine:koa:tutorial:figuresTranslate
149166
```
150167
151-
This script checks out all SVG images from `upstream` and replaces the strings according to `images.yml`.
168+
This script checks out all SVG images from `upstream` (English version) and replaces the strings inside them according to `images.yml`. So they become translated.
169+
170+
New SVGs are the tutorial folder now, but not committed yet.
171+
172+
You may want to open and see them, e.g. in Chrome browser, just to ensure that the translation fits well.
152173
153-
Now images in the tutorial folder are translated, but not committed yet.
174+
P.S. If an image appears untranslated on refresh, force the browser to "reload without cache" ([hotkeys](https://en.wikipedia.org/wiki/Wikipedia:Bypass_your_cache#Bypassing_cache)).
154175
155-
**Step 4.** Then you'll need `git add/commit/push` the translated SVGs, as a part of the normal translation flow.
176+
**Step 4.** Then you'll need to `git add/commit/push` the translated SVGs, as a part of the normal translation flow.
156177

157-
You may want to open the translated SVGs directly in the browser to take a look at them before committing. Just to make sure that the translation looks all right. If an image is untranslated on refresh, force the browser to "reload without cache" ([hotkeys](https://en.wikipedia.org/wiki/Wikipedia:Bypass_your_cache#Bypassing_cache)).
158178

159179

160180
> To translate a single image, use the `--image` parameter of the script:

0 commit comments

Comments
 (0)