weblate icon indicating copy to clipboard operation
weblate copied to clipboard

Add ICU syntax highlighting with XML

Open dakur opened this issue 3 years ago • 6 comments

Describe the issue

In icu-message-format docs, there are useful icu-flags mentioned, but there is no explanation on how to use it.

I've tried icu-message-format,icu-flags:xml

image

but that didn't seem to work (icu syntax got highlighted, but XML tags didn't):

image

I already tried

  • [X] I've read and searched the documentation.
  • [X] I've searched for similar issues in this repository.

Steps to reproduce the behavior

Expected behavior

No response

Screenshots

No response

Exception traceback

No response

How do you run Weblate?

Docker container

Weblate versions

4.13.1

Weblate deploy checks

No response

Additional context

No response

dakur avatar Sep 23 '22 13:09 dakur

Now I found this doc page from which it seems that icu-message-format,icu-flags:xml is truly correct.

However, it still doesn't work. Did I misunderstand something?

dakur avatar Sep 23 '22 15:09 dakur

Ok, there are two problems:

  • code blocks in docs are probably broken, because in source file on github, I can see the example (search for icu-message-format, icu-flags:xml:-plural_selectors)
  • icu-flags:xml does not work or does something else than I expect. Shouldn't it highlight HTML/XML tags in ICU syntax (like above)?

dakur avatar Sep 23 '22 15:09 dakur

I think the xml flag has no effect on UI highlighting, it affects the check only. The documentation for check is here: https://docs.weblate.org/en/weblate-4.13.1/user/checks.html#check-icu-message-format

nijel avatar Sep 26 '22 07:09 nijel

@nijel Thanks for response. But icu-message-format does UI highlighting, doesn't it? How do I recognize which check does and which one doesn't?

I found the docs, but as I mentioned above, the .. code-block::text is not transformed, it's removed, see:

dakur avatar Sep 26 '22 09:09 dakur

Yes, it does, but there is no highlighting available for ICU+XML in PrismJS we use, thus the XML flag has no effect here. Once the highlighting would be available, it can be easily enabled in Weblate here:

https://github.com/WeblateOrg/weblate/blob/6b1083389871916a6c4cb9e26f1823c9250b5cdb/weblate/trans/models/unit.py#L1414-L1428

The docs should be fixed by 6b1083389871916a6c4cb9e26f1823c9250b5cdb, thanks for spotting.

nijel avatar Sep 26 '22 09:09 nijel

This issue has been added to the backlog. It is not scheduled on the Weblate roadmap, but it eventually might be implemented.

In case you need this feature soon, please consider helping or push it by funding the development.

github-actions[bot] avatar Sep 26 '22 10:09 github-actions[bot]