File tree 1 file changed +7
-2
lines changed
1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -178,17 +178,22 @@ Click on a tile to change the directionality:
178
178
[:octicons-file-code-24 : Source][1] ·
179
179
:octicons-mortar-board-24 : Difficulty: _easy_
180
180
181
- If you want to customize some of the translations for your language, just follow
181
+ If you want to customize some of the translations for a language, just follow
182
182
the guide on [theme extension][9] and create a new partial in
183
183
` partials/languages` , e.g. `en-custom.html`. Next, look up the translation you
184
184
want to change in the [base translation][1] and add it to the partial.
185
185
186
186
Let's say you want to change "__Table of contents__" to "__On this page__" :
187
187
188
188
` ` ` html
189
- {% macro t(key) %}{{ {
189
+ <!-- Use en language as fallback -->
190
+ {% import "partials/languages/en.html" as fallback %}
191
+ {% macro override(key) %}{{ {
190
192
"toc.title": "On this page"
191
193
}[key] }}{% endmacro %}
194
+
195
+ <!-- Re-export the translation macro for mkbuild-material to use -->
196
+ {% macro t(key) %}{{ override(key) or fallback.t(key) }}{% endmacro %}
192
197
` ` `
193
198
194
199
Then, add the following lines to `mkdocs.yml` :
You can’t perform that action at this time.
0 commit comments