1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Anuncie Aqui
    Anuncie aqui você Também: fdantas@4each.com.br

Plural support for typescript in Angular 18

Discussão em 'Angular' iniciado por Gokul Raj Shanmugam, Outubro 4, 2024.

  1. Currently, I am upgrading my app to angular 18 and also am migrating i18n from ngx-translate to angular/localize. Unfortunately, I couldn't achieve plural in typescript, I can do the same in html. Below is my translation text, can someone suggest whether is it support? if yes guide me how to do that properly,

    const i18NValue = $localize:mad:@MessageID:Found {count, plural, =1 {item} other {items}};


    Expected text: Found item or Found items.

    After extract when I check the trans-unit

    Found {count, plural, =1 {item} other {items}}


    this doesn't recognise as ICU.

    Tried changing the localization expression, e.g.:

    $localize:mad:@MessageID:Found ${count}:{count, plural, =1 {item} other {items}};

    $localize:mad:@MessageID:Found {${count}, plural, =1 {item} other {items}};

    $localize:mad:@MessageID:Found ${count, plural, =1 {item} other {items}};


    but nothing worked.

    Continue reading...

Compartilhe esta Página