daniel-sc / ng-extract-i18n-merge

Extract and merge i18n xliff translation files for angular projects.
MIT License
179 stars 19 forks source link

includeContext: true removing notes from original messages.xlf #80

Closed reifi closed 1 year ago

reifi commented 1 year ago

Describe Bug <notes> are removed from messages.xlf after update to ng-extract-i18n-merge v2.8.0

I just installed Angular 16.2.11 and ng-extract-i18n-merge through ng update, did run ng extract-i18n --format=xlf2 --output-path src/locale and noticed during commit that all notes are removed from messages.xlf and all other configured xlf files

Setup/Configuration

Have not changed my extract config for months: includeContext in angular.json was always set to true

"extract-i18n": {
          "builder": "ng-extract-i18n-merge:ng-extract-i18n-merge",
          "options": {
            "browserTarget": "bpwebapp:build",
            "outputPath": "src/locale",
            "format": "xlf2",
            "includeContext": true,
            "targetFiles": [
              "messages.en-150.xlf",
              "messages.it.xlf"
            ]
          }
        }

messages.xlf diff part during commit:

image

Expected behavior

messages.xlf and other configured xlf files should keep notes when includeContext:true is defined

Version (please complete the following information):

Additional context

I hope I did not miss anything obvious with this update - but as I didn't change anything relevant I would not have expected to see changes in messages.xlf after updating with this config.

I did not have a deep look into this issue yet but will of course add to this ticket if I find something later on.

Thanks for this npm package by the way, it's a win for angular community.

daniel-sc commented 1 year ago

@reifi please check if v.2.8.1 fixes this (thanks for this thorough bug report!)

reifi commented 1 year ago

Yes!

Source is and always was for 1+ years I think:

4013: {
    default: $localize`:Message Limit exceeded
    @@bpweb.error.bpapi.4013.msg_limit_exceeded:Nachrichtenlimit überschritten`
  },

Result now:

image

Looks great! kind of 😉

Thanks a lot for looking into this!

I found something else nowtoo, in the translations files besides messages.xlf, that was also in before with v2.8.0, a translation that jumps from 'translated' to 'initial': image also with a newline.

The Source, last time changed 8 months ago is:

<a href="#/msg/outbox"
           [ngClass]="{active:ms.isMenu('msg/outbox')}"
           i18n="@@submenu.msg.outbox">Ausgang
           <!-- TODO: xxxxxxxxxxx xxx xx xxx -->
          <span class="message-indicator" [hidden]="!intervalService.messageSummary.data.outboxTotal">
            {{intervalService.messageSummary.data.outboxTotal}}</span>
        </a>

It might look strange, but it's a hybrid Angularjs/Ngx app that works.