[JPP-Devel] [jump-pilot:bugs] Re: #501 I18N from extension

2020-08-31 Thread ede via Jump-pilot-devel
On 31.08.2020 19:15, michael michaud wrote:
> Yes, neat, i'm ok with this proposition ;-)
> Does it mean you would also remove getMessage variant ?

absolutely. only the mentioned methods will survive. the milestone is already 
set to OJ2. let's tackle it then. ..ede


---

** [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 05:15 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


Re: [JPP-Devel] [jump-pilot:bugs] Re: #501 I18N from extension

2020-08-31 Thread Giuseppe Aruta
>I18N.getInstance("my.great.extension").get(String)

seems more logical and easy to use


Il lun 31 ago 2020, 18:58 ede via Jump-pilot-devel <
jump-pilot-devel@lists.sourceforge.net> ha scritto:

> On 8/31/2020 18:19, michael michaud wrote:
>
> 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)
>
> don't like getText() vs getMessage(). i suppose that is going to confuse
> developers, because actually there is no difference between text and
> Message here.
>
> we have the rare chance of breaking backward compatibility with OJ2 let's
> take advantage of it as we will have to touch every extension anyway!
>
> let me propose something logically more sound, even if it'll be a little
> bit more work for us
>
> static (we could hide these, but i don't see why. when first argument is
> null the default resourcebundles are used)
> get(File,String,Object...objects)
> get(String,String,Object...objects)
>
> instance
> get(String,Object...objects) //this notation includes get(String) without
> objects as well
>
> this'll allow for OJ Core
> I18N.getInstance().get(String)
>
> for instances
> I18N.getInstance("my.great.extension").get(String)
> or
> I18N i18n = I18N.getInstance("my.great.extension");
> i18n.get(String)
> i18n.get(String, Object, Object)
> i18n.get(String, new Object[]{ o1, o2, o3})
> --
>
> * [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 04:19 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
>
___
Jump-pilot-devel mailing list
Jump-pilot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel


[JPP-Devel] [jump-pilot:bugs] Re: #501 I18N from extension

2020-08-31 Thread ede via Jump-pilot-devel
On 8/31/2020 18:19, michael michaud wrote:
> 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)

don't like getText() vs getMessage(). i suppose that is going to confuse 
developers, because actually there is no difference between text and Message 
here.

we have the rare chance of breaking backward compatibility with OJ2 let's take 
advantage of it as we will have to touch every extension anyway!

let me propose something logically more sound, even if it'll be a little bit 
more work for us

static (we could hide these, but i don't see why. when first argument is null 
the default resourcebundles are used)
get(File,String,Object...objects)
get(String,String,Object...objects)

instance
get(String,Object...objects) //this notation includes get(String) without 
objects as well

this'll allow for OJ Core
I18N.getInstance().get(String)

for instances
I18N.getInstance("my.great.extension").get(String)
or
I18N i18n = I18N.getInstance("my.great.extension");
i18n.get(String)
i18n.get(String, Object, Object)
i18n.get(String, new Object[]{ o1, o2, o3})


---

** [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 04:19 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


[JPP-Devel] [jump-pilot:bugs] Re: #501 I18N from extension

2020-08-31 Thread ede via Jump-pilot-devel
On 8/31/2020 12:32, michael michaud wrote:
> Ede, I prefer to document the usage of I18N in Extension in a separate ticket.

ok

> 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);

i believe that's the the path prefix possibility was added

> - the only public method you can use to get a key in this case is  
> getText(final String categoryPrefix, final String key).

which i deprecated in favour of the newer more formalized getMessage()

> 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 it would. probably why i kept the full getMessage() private too add a 
way not to be forced to use it over and over. can't tell you anymore. long time 
ago.

i see that getMessage(final _File path_, final String label, final Object... 
objects) is public already ;)

> - 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

unfortunately we cannot make getMessage() not-static without changing a lot of 
code. how about just adding instance version just named get(final String label, 
final Object... objects)? should suffice or?

..ede


---

** [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 10:32 AM 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