question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Can you use angular-translate with ngPluralize?

See original GitHub issue

Hello,

Is it possible to do something like this:

<div ng-pluralize count="count" when="{
    '1':'1 {{'SINGULAR' | translate}}',
    'other':'{{count | number}} {{'PLURAL' | translate}}'
}"></div>

The issue is probably single quotes inside single quotes. I could use the messageFormat plugin, but I’m trying to avoid adding extra code.

Issue Analytics

  • State:closed
  • Created 10 years ago
  • Comments:7 (6 by maintainers)

github_iconTop GitHub Comments

10reactions
Francisccommented, Mar 12, 2014

I found an awful solution…

<div ng-pluralize count="count" when="{
    '1':'1 {{&quot;SINGULAR&quot; | translate}}',
    'other':'{{count | number}} {{&quot;PLURAL&quot; | translate}}'
}"></div>
0reactions
JohnMarkTcommented, Sep 26, 2018

Another solution, but not much better:

<div ng-pluralize count="count"
    ng-init="singularText = 'SINGULAR'; pluralText = 'PLURAL'"
    when="{
    '1':'1 {{singularText | translate}}',
    'other':'{{count | number}} {{pluralText | translate}}'
}"></div>
Read more comments on GitHub >

github_iconTop Results From Across the Web

AngularJS translation with pluralization using angular-translate
3 Answers 3 · 1. Still wondering if there is a way of making this with more options with some kind of statements...
Read more >
Support of translation inside ng-pluralize directive #15 - GitHub
To bring pluralization to angular-translate, we want to use MessageFormat.js. MessageFormat uses a different syntax. So you have to decide to either use...
Read more >
How to translate your Angular app with ngx-translate
1. Add ngx-translate to your Angular application 2. Set up the TranslateService in your app.module.ts 3. Create your main language translation file (in...
Read more >
Plural - Angular
Plurality cases used for translating plurals to different languages. See alsolink · NgPlural · NgPluralCase · Internationalization (i18n) Guide.
Read more >
Doc: Guide - Angular Translate
The easiest way to bring i18n and l10n to your Angular apps! ... When you read this doc, you'll learn how to use...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found