Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[jgit-dev] JGit translatability issue

Just started working on externalizing strings in JGit into translation
bundles and hit the first issue. The help text for JGit commands
and options is written using annotations. Example:

@Command(common = true, usage = "Create an empty git repository")
class Init extends TextBuiltin {
        @Option(name = "--bare", usage = "Create a bare repository")
        private boolean bare;
...
}

The problem is that the values of annotation attributes must be compile
time constants... so writing something like

@Command(common = true, usage = InitText.get().createAnEmptyRepository)

fails with a compiler error.

My next idea was to actually specify the translation key as the attribute value:

@Command(common = true, usage = "createAnEmptyRepository")

and then get the proper translation at the place where --help logic is.
However, printing help text is part of the args4j library.
Additionally, this approach would be ugly because the translation key
would be given as a string and the compile type check provided by
using NLS/TranslationBundle "framework" would be lost.


Do you have any other/better idea on how to approach this issue?

Sasa


Back to the top