Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

np-pluralize #2

Closed
ankostyuk opened this issue Feb 18, 2015 · 0 comments
Closed

np-pluralize #2

ankostyuk opened this issue Feb 18, 2015 · 0 comments
Assignees

Comments

@ankostyuk
Copy link
Member

ng-pluralize не форматирует счетчик согласно текущей локали:

<ng-pluralize 
    count="c = 123456789" 
    when="{'one': '{} корова', 'few': '{} коровы', 'many': '{} коров', 'other': '{} коровы'}"
></ng-pluralize>

<!-- 123456789 коров -->

Для форматирования надо использовать следующий подход:

<ng-pluralize 
    count="c = 123456789" 
    when="{'one': '{{c | number}} корова', 'few': '{{c | number}} коровы', 'many': '{{c | number}} коров', 'other': '{{c | number}} коровы'}"
></ng-pluralize>

<!-- 123 456 789 коров -->

что неудобно:

  • при заполнении переводов ухудшается читаемость
  • необходимо отслеживать область видимости переменной c в count="c = <Number>",
    т.к. возможно переопределение данной переменной в других директивах ng-pluralize в том же scope. Или использовать уникальное наименование переменной, что увеличивает возможность ошибки.

Реализовать директиву np-pluralize с форматированием счетчика по умолчанию согласно текущей локали.

<np-pluralize 
    count="c = 123456789" 
    when="{'one': '{} корова', 'few': '{} коровы', 'many': '{} коров', 'other': '{} коровы'}"
></np-pluralize>

<!-- 123 456 789 коров -->

rsearch 134

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant