-
Notifications
You must be signed in to change notification settings - Fork 4
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
Explain parameter usage #23
Comments
The usage of parametrized messages is not explicitly mentioned in the documentation as Kilt has no explicit support for them. It is just agnostic to the actual localized messages and whether they contain any placeholders (as is the same with Javas handling of l10n resource bundles). While it does seem tempting to provide such functionality for ease of use I am not very keen on supporting it. As you already noted, a decision would have to be made about the format of such placeholders (like As is stands now Kilt just returns the bare massage including all placeholders. That can then be filled with the actual parameters. For example by using java.text.MessageFormat: final String msgTemplate= i18n.get(Msg.ADDED_GROUP_0);
final String msg = java.text.MessageFormat.format(msgTemplate, theGroupName);
While I have no experience with it, Or, as jabRef seems to be doing, by using simple String replacements. Do you still think that Kilt should have explicit support for parametrized messages? If yes, can you provide me examples of the advantages compared to using the above mentioned replacement methods? Footnotes
|
I have no objections regarding that approach. Kilt tries to not impose any specific style of localization. While the generated field names in a Kilt generated facade may be a bit unwieldy due to their length, they should still be rather usable, especially with IDE support. May I ask what you intend to do with Kilt? Are you considering using it to create such a facade to be used in jabRef? Or do you consider using the import/export functionality from/to XLSX of Kilt? |
Yes. I was thinking if it was possible to drop all our localization-related tests (e.g., https://github.com/JabRef/jabref/blob/main/src/test/java/org/jabref/logic/l10n/LocalizationConsistencyTest.java) and to use a maintained library/eco system to foster synergy effects. However, it seems that JabRef's handling is more sophisticated than I thought.
No, because we come along well with Crowdin 😅 |
OK. Can this issue be closed then? Or do you think there is still something to be done? |
I closed it, but hope the explaining text would find its way to the documentation. 😅 |
My wish was final String msgTemplate= i18n.get(Msg.ADDED_GROUP_0, theGroupName); Thus, having |
The documentation does not bring clarity how to use parameterized messages
Example:
Then,
i18n.get(Msg.ADDED_GROUP_0, theGroupName)
can be used to generate the localized message.If it it not implemented yet, I would voite for using
{}
as place holder.Note: We use the full (!) English message as key to ensure that the Java code is clear w.r.t. concrete message. Maybe, we could change that, but we were successful since approximately 10 years with that. [Details]
The text was updated successfully, but these errors were encountered: