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

How to keep '\u200b' in generated xlf file? #131

Closed
Cosifne opened this issue Sep 18, 2023 · 3 comments
Closed

How to keep '\u200b' in generated xlf file? #131

Cosifne opened this issue Sep 18, 2023 · 3 comments
Assignees
Labels
info-needed Issue requires more information from poster

Comments

@Cosifne
Copy link
Member

Cosifne commented Sep 18, 2023

We have links need translated like https://github.com/dotnet/vscode-csharp/blob/a62858ca0eaaf750d3aff17c87e52d4ca779891b/package.nls.json#L248 includes \u200b
However, when I run generate-xlf, \u200b is not reserved in the xlf files.
image
image

This is causing the localization engine to remove \u200b from the link.
https://github.com/dotnet/vscode-csharp/pull/6388/files
Is there any way to keep the character

@Cosifne Cosifne changed the title How to keep '\u200b' in generated xlf file How to keep '\u200b' in generated xlf file? Sep 18, 2023
@Cosifne
Copy link
Member Author

Cosifne commented Sep 22, 2023

Tag @TylerLeonhardt to help

@TylerLeonhardt
Copy link
Member

I just tried this and I can't repro:

package.nls.json:

{
    "generateOptionsSchema.symbolOptions.searchMicrosoftSymbolServer.description": {
        "message": "If 'true' the Microsoft Symbol server (https\u200b://msdl.microsoft.com\u200b/download/symbols) is added to the symbols search path. If unspecified, this option defaults to 'false'.",
        "comment": [
          "We use '\u200b' (unicode zero-length space character) to break VS Code's URL detection regex for URLs that are examples. Please do not translate or localized the URL.",
          "{Locked='(https\u200b://msdl.microsoft.com\u200b/download/symbols)'}"
        ]
    }
}

Command output:

>> npx @vscode/l10n-dev@latest generate-xlf ./package.nls.json -o foo.xlf
Searching for L10N JSON files...
Found 1 L10N JSON files. Generating XLF...
Wrote XLF file to: foo.xlf

Resulting XLF:
image
Raw XLF if you want to copy and verify yourself:

<?xml version="1.0" encoding="utf-8"?>
<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2">
  <file original="package" source-language="en" datatype="plaintext"><body>
    <trans-unit id="generateOptionsSchema.symbolOptions.searchMicrosoftSymbolServer.description">
      <source xml:lang="en">If &apos;true&apos; the Microsoft Symbol server (https​://msdl.microsoft.com​/download/symbols) is added to the symbols search path. If unspecified, this option defaults to &apos;false&apos;.</source>
      <note>We use &apos;&apos; (unicode zero-length space character) to break VS Code&apos;s URL detection regex for URLs that are examples. Please do not translate or localized the URL.
{Locked=&apos;(https​://msdl.microsoft.com​/download/symbols)&apos;}</note>
    </trans-unit>
  </body></file>
</xliff>

Are you able to repro this locally?

@TylerLeonhardt TylerLeonhardt added the info-needed Issue requires more information from poster label Sep 25, 2023
@TylerLeonhardt TylerLeonhardt self-assigned this Sep 25, 2023
@Cosifne
Copy link
Member Author

Cosifne commented Sep 25, 2023

Ah I just checked the loc content looks like it is actually perserved. (Just Github doesn't show it in the PR) Close this issue.
Thanks Tyler!

@Cosifne Cosifne closed this as completed Sep 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
info-needed Issue requires more information from poster
Projects
None yet
Development

No branches or pull requests

2 participants