Skip to content

Commit b87e711

Browse files
authored
Update README.md
1 parent 5c0fcf0 commit b87e711

File tree

1 file changed

+50
-5
lines changed

1 file changed

+50
-5
lines changed

README.md

Lines changed: 50 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -125,22 +125,67 @@ It does not "watch" tutorial text, but it reloads the server after code changes.
125125
126126
Again, that's for developing the server code itself, not writing the tutorial.
127127
128-
# Importing images
128+
# Translating images
129129
130-
You only need to re-import images if you change them, or change their translations in `images.yml`.
130+
Most pictures are in SVG format. Strings inside it are usually just text, it can be replaced.
131131
132-
To do that, you need to have Mac and Sketch editor installed.
132+
That's great, as there are many strings in English in images, like tips, notes, etc. They look nice when translated.
133+
134+
Image translations reside in `images.yml` file in the repository root, for example: <https://github.com/javascript-tutorial/ru.javascript.info/blob/master/images.yml>
135+
136+
The file format is called "YAML", it's quite easy to understand:
137+
138+
```yaml
139+
code-style.svg: # image file name
140+
"No space": # English string
141+
text: "Без пробелов" # translation
142+
position: "center" # (optional) "center" or "right" - to position translated string.
143+
```
144+
145+
The translated string may become longer or shorter. If we have nice pictures, strings move around and need to be repositioned:
133146

134-
1. The task to get YAML with strings in image (for translation, to add to `images.yml`):
147+
- `position: "right"` makes sure that after the translation the string right edge is at the same place, like this (below is the translated string):
148+
```
149+
hello world
150+
你好世界
151+
```
152+
- `position: "center"` centers the translated string, good if you have a vertical diagram.
153+
```
154+
hello world
155+
你好世界
156+
```
157+
- (default) the string left edge is the same:
158+
```
159+
hello world
160+
你好世界
161+
```
162+
163+
164+
165+
## Extract strings
166+
167+
The task to get all strings from an image (for translation, to add to `images.yml`):
135168
```
136169
cd /js/server
137170
NODE_LANG=ru npm run gulp engine:koa:tutorial:imageYaml --image hello.svg
138171
```
139-
2. The task to import images from Sketch and apply translations:
172+
173+
174+
# Importing images
175+
176+
If you modify `figures.sketch` file with pictures (need Mac and Sketch editor installed for that), images are re-imported automatically by `./edit` script.
177+
178+
To do that manually:
140179
```
141180
cd /js/server
142181
NODE_LANG=ru npm run gulp engine:koa:tutorial:figuresImport
143182
```
183+
184+
You only need to re-import images if you change them, or change their translations in `images.yml`.
185+
186+
To do that, you need to have Mac and Sketch editor installed.
187+
188+
144189
145190
# Troubleshooting
146191

0 commit comments

Comments
 (0)