get(String key) with a single parameter is already used as a static method, so
it would be a bit confusing(static get(key) is the most frequently used method
of I18N).
Also the deprecated getText method currently has a static version and a non
static version. None of them seem to be used in OpenJUMP.
Suggestion :
-keep get and getMessage as static methods only
-un-deprecate getText(String) instance method
-add a two parameters getText instance method : getText(String,Object[])
-remove definitetely the deprecated static getText(String,String) method
Oh, just see in de.latlon.deejump.wfs.i18n that you can use getMessage(File
file,...) to use a properties file located anywhere in your classpath. My first
remark about having to name properties file "language/jump.properties" is not
true. Nice.
Also static getMessage(File,String,Object[]) is only used in wfs, and it is
used in a derived class in order to remove the first argument. What about
removing also this method (replaced by I18N(File).getText() as proposed above ?
String getText(Syting label)
String getText(Syting label, Object...objects)
static String get(Syting label) // legacy
static String getMessage(Syting label)
static String getMessage(Syting label, Object...objects)
must remove :
static getText(String,String)
could remove
static getMessage(File,String,Object...objects)
---
** [bugs:#501] I18N from extension**
**Status:** open
**Milestone:** undecided
**Created:** Mon Aug 31, 2020 10:32 AM UTC by michael michaud
**Last Updated:** Mon Aug 31, 2020 03:55 PM UTC
**Owner:** nobody
Ede, I prefer to document the usage of I18N in Extension in a separate ticket.
Here are two reasons which drove me to use a hack instead of the I18N class
(indeed there is a third : I have been too lazy to try to fix the two former
reasons) :
- using categoryPrefixOrPath with properties files in the classpath means files
are in a subdirectory named language/jump (generally possible, but no much
reason to be constrained like that);
- the only public method you can use to get a key in this case is
getText(final String categoryPrefix, final String key). Currently,
getMessage(final Object categoryPrefixOrPathOrI18n,
final String label, final Object... objects) is private. Not sure if we
must make it public or if we must use I18N instances in extensions instead of
static methods. A class instance could avoid repeating the
categoryPrefixOrPathOrI18n parameter again and again).
- indeed, we can create an instance of I18 for a particular extension, but we
cannot really use it as most methods are static. For example, if I create an
instance for myExtension, calling getMessage(final String label, final
Object... objects) will not search keys in myExtension but in main openjump
properties file
---
Sent from sourceforge.net because jump-pilot-devel@lists.sourceforge.net is
subscribed to https://sourceforge.net/p/jump-pilot/bugs/
To unsubscribe from further messages, a project admin can change settings at
https://sourceforge.net/p/jump-pilot/admin/bugs/options. Or, if this is a
mailing list, you can unsubscribe from the mailing list.
_______________________________________________
Jump-pilot-devel mailing list
Jump-pilot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel