-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathi18n
29 lines (29 loc) · 1002 Bytes
/
i18n
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
{%- if page.lang -%}
{%- assign this_lang = page.lang -%}
{%- else -%}
{%- assign this_lang = site.data.config.lang -%}
{%- endif -%}
{%- include patterns/i18n-params -%}
{%- if include.id contains '.' -%}
{%- assign split_id = include.id | split: '.' -%}
{%- assign this_id = split_id[1] -%}
{%- assign source = split_id[0] -%}
{%- elsif site.ui_data_path -%}
{%- assign this_id = include.id -%}
{%- assign source = site.ui_data_path -%}
{%- else -%}
{%- assign this_id = include.id -%}
{%- assign source = 'patterns' -%}
{%- endif -%}
{%- if include.source -%}
{%- assign ui_data_path = include.source -%}
{%- elsif source -%}
{%- assign ui_data_path = source -%}
{%- else -%}
{%- assign ui_data_path = site.ui_data_path -%}
{%- endif -%}
{%- if site.data[ui_data_path].ui[this_id][site.data.config.lang] == -%}
{{- site.data[ui_data_path].ui[this_id]['en'] -}}
{%- else -%}
{{- site.data[ui_data_path].ui[this_id][this_lang] -}}
{%- endif -%}