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

Invalid attribute name error on merge and normalizing step #121

Closed
sporatrx opened this issue Nov 21, 2024 · 8 comments
Closed

Invalid attribute name error on merge and normalizing step #121

sporatrx opened this issue Nov 21, 2024 · 8 comments
Assignees
Labels
bug Something isn't working

Comments

@sporatrx
Copy link

Bug Description
I am experiencing a problem executing extract-i18n on an existing project of mine since some update as it did work before. Unfortunately I do not know when this error did start popping up and to which update it thus might be related.

When executing extract-i18n on my project it successfully extracts the strings into my messages.xlf file but fails at the next step when trying to merge and normalize the first localized messages.xlf file (In my case it is named messages.de-DE.xlf.) with the error:

An unhandled exception occurred: Invalid attribute name
Line: 0
Column: 68
Char: "
See "/private/var/folders/bt/l2td87q16sj_vlx9qbt9qgbc0000gp/T/ng-2YQAOp/angular-errors.log" for further details.

image

This seems to be some kind of sax.js error as far as I understand. I checked both the messages.xlf and messages.de-DE.xlf files if they are valid XML. Both are fine.

Can you point me into the right direction what might cause this error? I can also provide you the files in question if needed. I first have to check back with my employer though if this is okay.

Expected behavior
All xlf files should be merged and updated with newly extracted strings from the messages.xlf file.

Version

  • Angular: 18
  • OS: MacOS Sequia 15.1.1 (24B91)
  • nodejs: v20.14.0
  • ng-extract-i18n-merge version: 2.12.0
@sporatrx sporatrx added the bug Something isn't working label Nov 21, 2024
@daniel-sc
Copy link
Owner

daniel-sc commented Nov 21, 2024

@sporatrx I'd suspect a malformed translation file. Would it be possible to share your configuration (angular.json) and your translation file either here or privately? (daniel-schreiber@gmx.de)

@sporatrx
Copy link
Author

sporatrx commented Nov 26, 2024

@daniel-sc Sorry for the wait! I had to clarify if it is okay to share these files. I sent you an email with the needed files to your address.

@daniel-sc daniel-sc self-assigned this Nov 26, 2024
@mjschranz
Copy link

Hi @daniel-sc and @sporatrx

I've been running into the same problem for projects. When you mention what you want shared from angular.json, do you mean just the following?


        "extract-i18n": {

          "builder": "ng-extract-i18n-merge:ng-extract-i18n-merge",

          "options": {

            "buildTarget": "pdf-template-mpr:build",

            "format": "xlf",

            "outputPath": "src/locale",

            "targetFiles": ["messages.fr.xlf", "messages.en.xlf"]

          }

        },

Sadly I can't attach XLF files here directly.

daniel-sc added a commit that referenced this issue Nov 27, 2024
fix: handle id with escaped characters - fixes #121
@daniel-sc
Copy link
Owner

@sporatrx @mjschranz can you please check if v2.13.1 resolves it for you?
(Note: the issue was a quote (" / ") in one of the ids)

@sporatrx
Copy link
Author

I can verify that extracting strings now works again for me.
image
Thank you very much for the quick help.

@mjschranz
Copy link

mjschranz commented Nov 27, 2024 via email

@mjschranz
Copy link

@daniel-sc Related to this error, I'm seeing something else similar after using this newer 2.13.1 patch but in another project that also uses XLF files. The 2.13.1 patch did still work for one project.

image001

Any thoughts? What info might you need>

@daniel-sc
Copy link
Owner

@mjschranz Please create a new bug for this and share the relevant xlf files and angular.json (preferably in the bug - alternatively to daniel-schreiber@gmx.de)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants