jelly translations

30 views
Skip to first unread message

Alceu Rodrigues de Freitas Junior

unread,
Mar 10, 2022, 9:44:21 AMMar 10
to Jenkins Documentation
Hello there,

I have a doubt about the process of translating text from jelly views as explained at https://www.jenkins.io/doc/developer/internationalization/i18n-jelly-views/.

I'll use a real example here.

After running:

./translation-tool.pl --lang pt_BR --add --counter

I got this new properties file (actually just the first 3 lines):

Enter\ text\ as\ shown=Entre\ com\ texto\ conforme\ mostrado
Create\ account=Criar\ conta
Weak=Fraca

But looking at the jelly view (again, edited to be easier to read):

grep '%' core/src/main/resources/hudson/security/HudsonPrivateSecurityRealm/signup.jelly

                                    >${%Enter text as shown}</label>
                        <h1>${%Create an account!}</h1>
                                            return "${%Weak}";


AFAIK, Java properties files should be keys followed by values, and the later can have a "\" to break lines.

Is the same concept of using "\n" applicable to the keys? Or should I have something like this instead?

Enter text as shown=Entre\ com\ texto\ conforme\ mostrado
Create account=Criar\ conta
Weak=Fraca

Thanks in advance!

Mark Waite

unread,
Apr 4, 2022, 9:49:29 AMApr 4
to Jenkins Documentation
Sorry that it has taken so long to respond to your message.  Responses are inline.  I've only recently made my first attempt to internationalize a Jenkins plugin.  I may be completely wrong in what I'm saying.

On Thursday, March 10, 2022 at 7:44:21 AM UTC-7 Alceu wrote:
Hello there,

I have a doubt about the process of translating text from jelly views as explained at https://www.jenkins.io/doc/developer/internationalization/i18n-jelly-views/.

I'll use a real example here.

After running:

./translation-tool.pl --lang pt_BR --add --counter

I got this new properties file (actually just the first 3 lines):

Enter\ text\ as\ shown=Entre\ com\ texto\ conforme\ mostrado
Create\ account=Criar\ conta
Weak=Fraca

But looking at the jelly view (again, edited to be easier to read):

grep '%' core/src/main/resources/hudson/security/HudsonPrivateSecurityRealm/signup.jelly

                                    >${%Enter text as shown}</label>
                        <h1>${%Create an account!}</h1>
                                            return "${%Weak}";


AFAIK, Java properties files should be keys followed by values, and the later can have a "\" to break lines.

Is the same concept of using "\n" applicable to the keys? Or should I have something like this instead?


As far as I know, keys may not contain newline characters.  Ultimately, the keys from Java properties files become Java identifiers.  I believe the same is true of keys from Jelly files.

Alexander Brandes (@NotMyFault on the gitter channel) has been guiding efforts in the Jenkins Docs SIG to improve the translation experience by using Crowdin Enterprise to manage the translation of Jenkins messages.  One of the guiding suggestions he gave me was to replace the literal text in the Jelly file with an identifier.  I've used that technique in https://github.com/jenkinsci/platformlabeler-plugin/pull/606/files to assure that the entries in the jelly files are valid Java identifiers  with no embedded spaces.

I (personally) find it hard to read property files with spaces embedded in the identifiers.  I haven't yet found any significant problems with using identifiers rather literal strings in the Jelly file.  However, my experience with translations is quite limited.

The Docs Office Hours recordings with his sessions should be available at https://community.jenkins.io/tag/sig-docs within the next 2-3 days.  I'm far behind on posting those recordings.  Meeting notes are available at in the Google Doc.

Mark Waite
Reply all
Reply to author
Forward
0 new messages