Open kai-zer-ru opened 4 months ago
It seems to me that it is not enough just to add translations of words. An algorithm is needed to substitute words depending on the number. Something like this:
{% macro endings(number,endings) %} {%- set cases = [2, 0, 1, 1, 1, 2] %} {%- if (number % 100 > 4 and number % 100 < 20) == true %} {%- set version = 2 %} {%- else %} {%- set version = cases[min(number % 10, 5)] %} {%- endif %} {{- endings[version] }} {%- endmacro %} {# ------- test --------#} {% for i in range(1,21) %} {{ i~' '~endings(i,['минуту', 'минуты', 'минут']) }} {% endfor %}
It seems to me that it is not enough just to add translations of words. An algorithm is needed to substitute words depending on the number. Something like this:
{% macro endings(number,endings) %} {%- set cases = [2, 0, 1, 1, 1, 2] %} {%- if (number % 100 > 4 and number % 100 < 20) == true %} {%- set version = 2 %} {%- else %} {%- set version = cases[min(number % 10, 5)] %} {%- endif %} {{- endings[version] }} {%- endmacro %} {# ------- test --------#} {% for i in range(1,21) %} {{ i~' '~endings(i,['минуту', 'минуты', 'минут']) }} {% endfor %}
are there different words for 0, 1, 2 through 4, and greater than 4?
are there different words for 0, 1, 2 through 4, and greater than 4?
Exactly. Not only for minutes, but for each & every unit. And different between ten's.
f.e. [minute] x0 минут x1 минута x2-x4 минуты x5-x9 минут
but: 10-19 минут
[second] x0 секунд x1 секунда x2-x4 секунды x5-x9 секунд
but: 10-19 секунд
[bar] x0 бар x1 бар x2-x4 бара x5-x9 бар
but: 10-19 бар
Add russian translate