You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+50-5Lines changed: 50 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -125,22 +125,67 @@ It does not "watch" tutorial text, but it reloads the server after code changes.
125
125
126
126
Again, that's for developing the server code itself, not writing the tutorial.
127
127
128
-
# Importing images
128
+
# Translating images
129
129
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.
131
131
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:
133
146
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`):
135
168
```
136
169
cd /js/server
137
170
NODE_LANG=ru npm run gulp engine:koa:tutorial:imageYaml --image hello.svg
138
171
```
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:
140
179
```
141
180
cd /js/server
142
181
NODE_LANG=ru npm run gulp engine:koa:tutorial:figuresImport
143
182
```
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.
0 commit comments