Skip to content

i18n translation duplicated #15573

Closed
Closed

Description

@elvisbegovic

I'm submitting a ... (check one with "x")

[x] bug report => search github for a similar issue or PR before submitting

Current behavior
Actually I have

<span class="slds-form-element__help" *ngIf="form.get('sapNumber').errors?.maxlength" i18n>Maximum de {{max8}} caractères autorisé.</span>
<span class="slds-form-element__help" *ngIf="form.get('interfaceAccountNumber').errors?.maxlength"  i18n>Maximum de {{max15}} caractères autorisé.</span>
<span class="slds-form-element__help" *ngIf="form.get('formDesignation').errors?.maxlength" i18n>Maximum de {{max20}} caractères autorisé.</span>
<span class="slds-form-element__help" *ngIf="form.get('shortDesignation').errors?.maxlength" i18n>Maximum de {{max35}} caractères autorisé.</span>

and when I extract with "./node_modules/.bin/ng-xi18n" --i18nFormat=xmb I get 4 times same strings to translate with different ID in my messages.xmb file. All others strings aren't duplicated but this one is, why ?

<msg id="4591664065864994257">Maximum de <ph name="INTERPOLATION"><ex>INTERPOLATION</ex></ph> caractères autorisé.</msg>
<msg id="3596670943450897156">Maximum de <ph name="INTERPOLATION"><ex>INTERPOLATION</ex></ph> caractères autorisé.</msg>
<msg id="27126914192147611">Maximum de <ph name="INTERPOLATION"><ex>INTERPOLATION</ex></ph> caractères autorisé.</msg>
<msg id="8495459888526831686">Maximum de <ph name="INTERPOLATION"><ex>INTERPOLATION</ex></ph> caractères autorisé.</msg>

N.B. I tried with {{15}} interpolation, I tried with max15 : string = "15" I tried with max15 : number = 15 and same behavior !

Expected behavior
Extract only one time this i18n string.

Please tell us about your environment: webstorm 2017.1

  • Angular version: 4.0.0

  • Language: [ts 2.2.1]

  • Node (for AoT issues): node --version = v7.7.2

Activity

  1. changed the title [-]i18n traduction duplicated[/-] [+]i18n translation duplicated[/+] on Mar 29, 2017
  2. ocombe commented on Mar 30, 2017

    @ocombe
    Contributor

    Hmm definitely a bug, even those 2 tags will generate two different ids just because of the extra spaces inside of the interpolation:

    <span i18n>Maximum de {{max}} caractères autorisé.</span>
    <span i18n>Maximum de {{ max }} caractères autorisé.</span>

    --> working on it

  3. elvisbegovic commented on Mar 30, 2017

    @elvisbegovic
    ContributorAuthor

    just wonder how this is possible, what am I doing here different from others tags? I use this syntax in many others components and it works.

    cc @ocombe

  4. ocombe commented on Mar 30, 2017

    @ocombe
    Contributor

    It's just that the digest function will take the name of the placeholder (and the content of the placeholder) into account when generating the id, which it obviously shouldn't because we only care about its position and the text around it

  5. 61 remaining items

  6. added
    P4A relatively minor issue that is not relevant to core functions
    and removed on Oct 1, 2020
  7. petebacondarwin commented on Oct 24, 2020

    @petebacondarwin
    Contributor

    I believe this is fixed by the new ivy extraction. I will create some tests to check.

  8. PowerKiKi commented on Oct 25, 2020

    @PowerKiKi
    Contributor

    I can confirm that I used to see duplicates in my project, but since my migration to Angular 10.1, this is no longer the case 🎉

  9. petebacondarwin commented on Oct 25, 2020

    @petebacondarwin
    Contributor

    Thanks for the update @PowerKiKi

  10. angular-automatic-lock-bot commented on Nov 25, 2020

    @angular-automatic-lock-bot

    This issue has been automatically locked due to inactivity.
    Please file a new issue if you are encountering a similar or related problem.

    Read more about our automatic conversation locking policy.

    This action has been performed automatically by a bot.

  11. locked and limited conversation to collaborators on Nov 25, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions