Hi Alceu,
I would expect that in most cases, the jelly files used by Jenkins and its
plugins would already be using localized strings (like "${%Hello World}"
which will use the "Hello World" resource from the bundle matching the
jelly file's basename.
I'm not sure why you would need any regex parsing on top of the XML
processing either (or write a grammar for Jelly when it's really XML); for
the standard set of jelly/stapler/... tags, the list of attributes that
contain "real" text should be fairly well-known.
And nested text nodes, especially for non-jelly tages, could likely always
be considered as localizable text.
Note: perhaps it would be useful for the IDEA plugin to have an inspection
that will suggest using "${%Hello World}" instead of just "Hello World" for
well-known attributes, like title on f:entry (probably the most common bit
of localizable text in a jelly file).
Perhaps even a CodeQL-based thing on GitHub, to identify possible
localization issues.
On Wed, 24 Aug 2022 at 18:29, Alceu Rodrigues de Freitas Junior <
[email protected]> wrote:
>
> Greetings,
>
> My name is Alceu and I'm new in this list.
>
> I reached here in the hope that I can get some pointers about writing a
> parser for Apache Jelly files.
>
> I've being working in a CLI to parse the properties and Jelly files from
> the Jenkins project, in order to help the translation process from English
> to other languages.
>
> The project is here:
> https://github.com/glasswalk3r/jenkins-translation-tool.
>
> The CLI is still using regular expressions for the Jelly parsing and I've
> struggling to replace that with proper parsers.
>
> I partially reached that by introducing a XML parser and then extracting
> the Jelly strings.
>
> The thing is, Jelly is complex enough that regular expression are still
> not good enough for parsing: I keep finding corner cases that are not being
> covered by an already complex regular expressions.
>
> I decided that is time to stop and try to build a proper grammar to parse
> Jelly.
>
> Now the problem is that I am not acquainted with the Jelly project itself (
> https://commons.apache.org/proper/commons-jelly/)
>
> If any of you could give some points about finding where is the Jelly
> grammar defined, I could try to use Antlr project to generate a grammar
> that can be used with one of the several grammars distributions available
> to Perl.
>
> Or, if you have a better suggestion than trying to use a grammar, I'm also
> open to it.
>
> Thanks in advance,
>
> Alceu
>
> --
> You received this message because you are subscribed to the Google Groups
> "Jenkins Developers" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/jenkinsci-dev/21f6b5d9-60d7-4c8b-a558-4b0136a2f78an%40googlegroups.com
> <https://groups.google.com/d/msgid/jenkinsci-dev/21f6b5d9-60d7-4c8b-a558-4b0136a2f78an%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
--
You received this message because you are subscribed to the Google Groups
"Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/jenkinsci-dev/CAKMi--B_syF8U8PT3jmJRi_PP47Jt_mXB%2BHBGYyEORRutHeZ7w%40mail.gmail.com.