Skip to content

Commit 192ae23

Browse files
committed
generalise mr localised digits to entry in translations.yml
1 parent 69d3b96 commit 192ae23

4 files changed

Lines changed: 21 additions & 6 deletions

File tree

TRANSLATIONS.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,11 @@ pages.
6868
zz: "YOUR TRANSLATION HERE"
6969
```
7070

71+
Note that if you want your translation to use localised digits for lesson numbers
72+
you may optionally add an entry to the `navigational-elements_digits` array
73+
with a string consisting of a comma separated list of numbers 0--20.
74+
(See the Marathi example in the file.)
75+
7176

7277
At this point your language should appear in the drop down menu to
7378
select languages, and the navigation between pages. Obviously the main

_data/translations.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -258,3 +258,8 @@ navigational-elements_toc:
258258
zh: "目錄"
259259
mr: "अनुक्रमणिका"
260260
ca: "Taula de contingut"
261+
262+
# optional list of localised numbers 0-20 (fr alphabetic just for testing)
263+
# fr: "*,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t"
264+
navigational-elements_digits:
265+
mr: "०,१,२,३,४,५,६,७,८,९,१०,११,१२,१३,१४,१५,१६,१७"

_includes/toc-lessons.html

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
<ul
22
class="lessons-toc">
3-
{% assign mrdigits="०,१,२,३,४,५,६,७,८,९,१०,११,१२,१३,१४,१५,१६,१७" | split: "," %}
3+
{% if site.data.translations['navigational-elements_digits'][page.lang] %}
4+
{% assign localdigits=site.data.translations['navigational-elements_digits'][page.lang] | split: "," %}
5+
{% endif %}
46
{% assign splitprefix = include.prefix | split: "/" %}
57
{% assign l = splitprefix[0] %}
68
{% for page in site.pages | sort: 'path' %}
@@ -19,9 +21,9 @@
1921
{% else %}
2022
{% assign pp = "-" | prepend: include.prefix %}
2123
{% endif %}
22-
{% if l == "mr" %}
24+
{% if localdigits %}
2325
{% assign pageno = page.path | replace: '.md','' | replace: pp ,'' | floor %}
24-
{{ mrdigits[pageno] }}
26+
{{ localdigits[pageno] }}
2527
{% else %}
2628
{{ page.path | replace: '.md','' | replace: pp ,'' }}
2729
{% endif %}</span>

_layouts/lesson.html

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,10 @@
1212
{% else %}
1313
<title>{{ page.title }} | {{site.title}}</title>
1414
{% endif %}
15-
{% assign mrdigits="०,१,२,३,४,५,६,७,८,९,१०,११,१२,१३,१४,१५,१६,१७" | split: "," %}
15+
{% if site.data.translations['navigational-elements_digits'][page.lang] %}
16+
{% assign localdigits=site.data.translations['navigational-elements_digits'][page.lang] | split: "," %}
17+
{% endif %}
18+
1619
<!-- alternate links start -->
1720
{% include alternate-links.html %}
1821
<!-- alternate links end -->
@@ -80,9 +83,9 @@
8083
<span
8184
class="meta"
8285
>{{ site.data.translations['informational-elements_lesson'][page.lang] }}
83-
{% if page.lang == "mr" %}
86+
{% if localdigits %}
8487
{% assign pageno = page.path | replace: '.md','' | remove_first: language | remove_first: '/' | replace: 'lesson-' ,'' | replace: 'more-' ,'' | replace: 'language-', '' | replace: 'extra-', '' | floor %}
85-
{{ mrdigits[pageno] }}
88+
{{ localdigits[pageno] }}
8689
{% else %}
8790
{{ page.path | replace: '.md','' | remove_first: language | remove_first: '/' | replace: 'lesson-' ,'' | replace: 'more-' ,'' | replace: 'language-', '' | replace: 'extra-', '' | round: 2 }}
8891
{% endif %}</span>

0 commit comments

Comments
 (0)