Discussion:
[Freecol-developers] More Questions About #43
Dong Kim
2016-11-27 20:21:55 UTC
Permalink
Hello,

I had a few more questions about ticket #43. In order to display EU selling
price, we are currently creating a new string to append
to Messages.message(item.getLabel()), and were wondering if we would need
to manually add Messages.key = value in all FreeColMessages.properties
files in /data/strings, or just simply keep the appended string.

In addition, we were thinking that users may be interested in both EU
buying and selling price when interacting in these trade/negotiation
dialogues, but we weren't sure if this was necessary. Should we be
displaying only the selling price? Also, if we were to display both buying
and selling price in EU, should we display both the bundle (getBidPrice)
and individual good type price (getCostToBuy), or just one of them? This
also goes for selling price (getSalePrice).

We also realized that this may lead to overlapping text or other unexpected
formatting in the UI if the text becomes too long, especially if the text
is in a button. Where should we look in the code to manage this? Would it
be possible to dynamically change the size of panels and buttons according
to the length of the text, or at least preserve text wrapping, if not done
so already?

Thanks!
Michael T. Pope
2016-11-27 21:07:52 UTC
Permalink
On Sun, 27 Nov 2016 15:21:55 -0500
Dong Kim <***@andrew.cmu.edu> wrote:
> I had a few more questions about ticket #43. In order to display EU selling
> price, we are currently creating a new string to append
> to Messages.message(item.getLabel()), and were wondering if we would need
> to manually add Messages.key = value in all FreeColMessages.properties
> files in /data/strings, or just simply keep the appended string.

FreeColMessages.properties is the master messages file. The translators
use that to make the internationalized versions thereof in
.../data/strings. Do not edit those, only the master messages file.

> In addition, we were thinking that users may be interested in both EU
> buying and selling price when interacting in these trade/negotiation
> dialogues, but we weren't sure if this was necessary.

I do not think so, both would probably be more confusing and cluttering.
When there is some goods to buy/sell all you are immediately worried about
is whether you can get a better price elsewhere. IIRC the dialogs are
specific to sales/purchases, so on a sales dialog only display selling
prices and vice versa.

> We also realized that this may lead to overlapping text or other unexpected
> formatting in the UI if the text becomes too long, especially if the text
> is in a button. Where should we look in the code to manage this?

Hopefully wintertime can comment here. I try to keep away from UI issues.
Generally though, where the text gets too long it can often be simplified
by using a (small) image, particularly for goods.

> Would it > be possible to dynamically change the size of panels and buttons according
> to the length of the text, or at least preserve text wrapping, if not done
> so already?

I doubt it will be possible or desirable to change sizes of existing
elements. IIRC FreeCol generally tries to have the full text for buttons
ready at the point of creation thus allowing the Java libraries to size
them suitably.

Cheers,
Mike Pope
w***@genial.ms
2016-11-28 12:21:02 UTC
Permalink
Hi,


> Gesendet: Sonntag, 27. November 2016 um 22:07 Uhr
> Von: "Michael T. Pope" <***@computer.org>
> An: freecol-***@lists.sourceforge.net
> Betreff: Re: [Freecol-developers] More Questions About #43
>
> On Sun, 27 Nov 2016 15:21:55 -0500
> Dong Kim <***@andrew.cmu.edu> wrote:
> > I had a few more questions about ticket #43. In order to display EU selling
> > price, we are currently creating a new string to append
> > to Messages.message(item.getLabel()), and were wondering if we would need
> > to manually add Messages.key = value in all FreeColMessages.properties
> > files in /data/strings, or just simply keep the appended string.
>
> FreeColMessages.properties is the master messages file. The translators
> use that to make the internationalized versions thereof in
> .../data/strings. Do not edit those, only the master messages file.
>

You should be careful to avoid any string manipulation on possibly translated
messages! For example, you might think its ok to just add them together and
it might then look like it was correct in English, but some other languages
can have other sentence structures and the thing you appended at the end
might need to be in the middle of the sentence in some other language or
it would be wrong.
I think, messages allow for parameters the translators can move around in
the translated sentence to avoid such problems. There are some helper methods
for doing that and you should be able to find examples in code and the
message file.

> > We also realized that this may lead to overlapping text or other unexpected
> > formatting in the UI if the text becomes too long, especially if the text
> > is in a button. Where should we look in the code to manage this?
>
> Hopefully wintertime can comment here. I try to keep away from UI issues.
> Generally though, where the text gets too long it can often be simplified
> by using a (small) image, particularly for goods.
>

Swing widgets have automatic resizing, but for some elements it got disabled
somehow in the code or constraints placed. FreeCol code is not consistent
in regards to that, so it depends on the parts you want to change.
Easiest is to just try it out (and it should also look well/be compatible with
activated --gui-scale commant line option).

> > Would it > be possible to dynamically change the size of panels and buttons according
> > to the length of the text, or at least preserve text wrapping, if not done
> > so already?
>
> I doubt it will be possible or desirable to change sizes of existing
> elements. IIRC FreeCol generally tries to have the full text for buttons
> ready at the point of creation thus allowing the Java libraries to size
> them suitably.
>

Yes, I'd try to avoid changing sizes, but some small adaptations might
turn out necessary. You better avoid putting too much text inside a button,
as that would look strange.


Greetings,

wintertime

------------------------------------------------------------------------------
Dong Kim
2016-11-29 22:30:44 UTC
Permalink
Hi again,

Thank you for the pointers! We realized that the panels do resize for
longer JButtons. However, for the messages, I'm not entirely sure if I
understand how the main FreeColMessages.properties get translated to other
property files. As an example, I've added the following new key value pairs
in FreeColMessages.properties:

negotiationDialog.euBuyPrice=(EU Buy Price: %priceTotal%)
negotiationDialog.euSalePrice=(EU Sale Price: %priceTotal%)
negotiationDialog.goldTrade=%amount% gold

And modified the following key value pairs:

buy.text=The %nation% would like to sell their %goods% for %gold%\n
(EU buy price:
%euprice%):
sell.text=The %nation% would like to buy your %goods% for %gold%\n (EU
sale price:
%euprice%):

I've also made changes to the buttons displayed on the panel (i.e.
NegotiationDialog) such as:

button.setText(Messages.message(item.getLabel()) + " " +
Messages.message(StringTemplate
.template("negotiationDialog.euSalePrice")
.addAmount("%priceTotal%", salePriceTotal)));

Does this conflict with any sentence structures in other languages? In the
game, everything is working as planned, but we haven't been testing in
other languages.

On Mon, Nov 28, 2016 at 7:21 AM, <***@genial.ms> wrote:

> Hi,
>
>
> > Gesendet: Sonntag, 27. November 2016 um 22:07 Uhr
> > Von: "Michael T. Pope" <***@computer.org>
> > An: freecol-***@lists.sourceforge.net
> > Betreff: Re: [Freecol-developers] More Questions About #43
> >
> > On Sun, 27 Nov 2016 15:21:55 -0500
> > Dong Kim <***@andrew.cmu.edu> wrote:
> > > I had a few more questions about ticket #43. In order to display EU
> selling
> > > price, we are currently creating a new string to append
> > > to Messages.message(item.getLabel()), and were wondering if we would
> need
> > > to manually add Messages.key = value in all FreeColMessages.properties
> > > files in /data/strings, or just simply keep the appended string.
> >
> > FreeColMessages.properties is the master messages file. The translators
> > use that to make the internationalized versions thereof in
> > .../data/strings. Do not edit those, only the master messages file.
> >
>
> You should be careful to avoid any string manipulation on possibly
> translated
> messages! For example, you might think its ok to just add them together and
> it might then look like it was correct in English, but some other languages
> can have other sentence structures and the thing you appended at the end
> might need to be in the middle of the sentence in some other language or
> it would be wrong.
> I think, messages allow for parameters the translators can move around in
> the translated sentence to avoid such problems. There are some helper
> methods
> for doing that and you should be able to find examples in code and the
> message file.
>
> > > We also realized that this may lead to overlapping text or other
> unexpected
> > > formatting in the UI if the text becomes too long, especially if the
> text
> > > is in a button. Where should we look in the code to manage this?
> >
> > Hopefully wintertime can comment here. I try to keep away from UI
> issues.
> > Generally though, where the text gets too long it can often be simplified
> > by using a (small) image, particularly for goods.
> >
>
> Swing widgets have automatic resizing, but for some elements it got
> disabled
> somehow in the code or constraints placed. FreeCol code is not consistent
> in regards to that, so it depends on the parts you want to change.
> Easiest is to just try it out (and it should also look well/be compatible
> with
> activated --gui-scale commant line option).
>
> > > Would it > be possible to dynamically change the size of panels and
> buttons according
> > > to the length of the text, or at least preserve text wrapping, if not
> done
> > > so already?
> >
> > I doubt it will be possible or desirable to change sizes of existing
> > elements. IIRC FreeCol generally tries to have the full text for buttons
> > ready at the point of creation thus allowing the Java libraries to size
> > them suitably.
> >
>
> Yes, I'd try to avoid changing sizes, but some small adaptations might
> turn out necessary. You better avoid putting too much text inside a button,
> as that would look strange.
>
>
> Greetings,
>
> wintertime
>
> ------------------------------------------------------------
> ------------------
> _______________________________________________
> Freecol-developers mailing list
> Freecol-***@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/freecol-developers
>
Caleb Williams
2016-11-29 22:42:33 UTC
Permalink
If you are making a change like that, as long as you following proper
formatting styles, how the translated string is input by the translator is
up to them.

I will see if I can dig up an example when I get home.

Caleb

On Nov 29, 2016 4:31 PM, "Dong Kim" <***@andrew.cmu.edu> wrote:

Hi again,

Thank you for the pointers! We realized that the panels do resize for
longer JButtons. However, for the messages, I'm not entirely sure if I
understand how the main FreeColMessages.properties get translated to other
property files. As an example, I've added the following new key value pairs
in FreeColMessages.properties:

negotiationDialog.euBuyPrice=(EU Buy Price: %priceTotal%)
negotiationDialog.euSalePrice=(EU Sale Price: %priceTotal%)
negotiationDialog.goldTrade=%amount% gold

And modified the following key value pairs:

buy.text=The %nation% would like to sell their %goods% for %gold%\n
(EU buy price:
%euprice%):
sell.text=The %nation% would like to buy your %goods% for %gold%\n (EU
sale price:
%euprice%):

I've also made changes to the buttons displayed on the panel (i.e.
NegotiationDialog) such as:

button.setText(Messages.message(item.getLabel()) + " " +
Messages.message(StringTemplate
.template("negotiationDialog.euSalePrice")
.addAmount("%priceTotal%", salePriceTotal)));

Does this conflict with any sentence structures in other languages? In the
game, everything is working as planned, but we haven't been testing in
other languages.

On Mon, Nov 28, 2016 at 7:21 AM, <***@genial.ms> wrote:

> Hi,
>
>
> > Gesendet: Sonntag, 27. November 2016 um 22:07 Uhr
> > Von: "Michael T. Pope" <***@computer.org>
> > An: freecol-***@lists.sourceforge.net
> > Betreff: Re: [Freecol-developers] More Questions About #43
> >
> > On Sun, 27 Nov 2016 15:21:55 -0500
> > Dong Kim <***@andrew.cmu.edu> wrote:
> > > I had a few more questions about ticket #43. In order to display EU
> selling
> > > price, we are currently creating a new string to append
> > > to Messages.message(item.getLabel()), and were wondering if we would
> need
> > > to manually add Messages.key = value in all FreeColMessages.properties
> > > files in /data/strings, or just simply keep the appended string.
> >
> > FreeColMessages.properties is the master messages file. The translators
> > use that to make the internationalized versions thereof in
> > .../data/strings. Do not edit those, only the master messages file.
> >
>
> You should be careful to avoid any string manipulation on possibly
> translated
> messages! For example, you might think its ok to just add them together and
> it might then look like it was correct in English, but some other languages
> can have other sentence structures and the thing you appended at the end
> might need to be in the middle of the sentence in some other language or
> it would be wrong.
> I think, messages allow for parameters the translators can move around in
> the translated sentence to avoid such problems. There are some helper
> methods
> for doing that and you should be able to find examples in code and the
> message file.
>
> > > We also realized that this may lead to overlapping text or other
> unexpected
> > > formatting in the UI if the text becomes too long, especially if the
> text
> > > is in a button. Where should we look in the code to manage this?
> >
> > Hopefully wintertime can comment here. I try to keep away from UI
> issues.
> > Generally though, where the text gets too long it can often be simplified
> > by using a (small) image, particularly for goods.
> >
>
> Swing widgets have automatic resizing, but for some elements it got
> disabled
> somehow in the code or constraints placed. FreeCol code is not consistent
> in regards to that, so it depends on the parts you want to change.
> Easiest is to just try it out (and it should also look well/be compatible
> with
> activated --gui-scale commant line option).
>
> > > Would it > be possible to dynamically change the size of panels and
> buttons according
> > > to the length of the text, or at least preserve text wrapping, if not
> done
> > > so already?
> >
> > I doubt it will be possible or desirable to change sizes of existing
> > elements. IIRC FreeCol generally tries to have the full text for buttons
> > ready at the point of creation thus allowing the Java libraries to size
> > them suitably.
> >
>
> Yes, I'd try to avoid changing sizes, but some small adaptations might
> turn out necessary. You better avoid putting too much text inside a button,
> as that would look strange.
>
>
> Greetings,
>
> wintertime
>
> ------------------------------------------------------------
> ------------------
> _______________________________________________
> Freecol-developers mailing list
> Freecol-***@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/freecol-developers
>


------------------------------------------------------------
------------------
Caleb Williams
2016-11-30 03:30:44 UTC
Permalink
In looking at your question, we should be safe. It is up to the translator
to make adjustments for local syntax. As long as the base string contains
the variable (i.e. %priceTotal%), the language's syntax can be used.

For example if the an American English phrase is: "The pineapple costs
$2.00." and the string would be "costPineapple=The pineapple costs
$%cost%." and the French string would be "costPineapple=L'ananas coûte
%cost% $."

Thanks,

*Caleb R. Williams*

On Tue, Nov 29, 2016 at 4:30 PM, Dong Kim <***@andrew.cmu.edu> wrote:

> Hi again,
>
> Thank you for the pointers! We realized that the panels do resize for
> longer JButtons. However, for the messages, I'm not entirely sure if I
> understand how the main FreeColMessages.properties get translated to other
> property files. As an example, I've added the following new key value pairs
> in FreeColMessages.properties:
>
> negotiationDialog.euBuyPrice=(EU Buy Price: %priceTotal%)
> negotiationDialog.euSalePrice=(EU Sale Price: %priceTotal%)
> negotiationDialog.goldTrade=%amount% gold
>
> And modified the following key value pairs:
>
> buy.text=The %nation% would like to sell their %goods% for %gold%\n (EU
> buy price: %euprice%):
> sell.text=The %nation% would like to buy your %goods% for %gold%\n (EU
> sale price: %euprice%):
>
> I've also made changes to the buttons displayed on the panel (i.e.
> NegotiationDialog) such as:
>
> button.setText(Messages.message(item.getLabel()) + " " +
> Messages.message(StringTemplate
> .template("negotiationDialog.euSalePrice")
> .addAmount("%priceTotal%", salePriceTotal)));
>
> Does this conflict with any sentence structures in other languages? In the
> game, everything is working as planned, but we haven't been testing in
> other languages.
>
> On Mon, Nov 28, 2016 at 7:21 AM, <***@genial.ms> wrote:
>
>> Hi,
>>
>>
>> > Gesendet: Sonntag, 27. November 2016 um 22:07 Uhr
>> > Von: "Michael T. Pope" <***@computer.org>
>> > An: freecol-***@lists.sourceforge.net
>> > Betreff: Re: [Freecol-developers] More Questions About #43
>> >
>> > On Sun, 27 Nov 2016 15:21:55 -0500
>> > Dong Kim <***@andrew.cmu.edu> wrote:
>> > > I had a few more questions about ticket #43. In order to display EU
>> selling
>> > > price, we are currently creating a new string to append
>> > > to Messages.message(item.getLabel()), and were wondering if we would
>> need
>> > > to manually add Messages.key = value in all FreeColMessages.properties
>> > > files in /data/strings, or just simply keep the appended string.
>> >
>> > FreeColMessages.properties is the master messages file. The translators
>> > use that to make the internationalized versions thereof in
>> > .../data/strings. Do not edit those, only the master messages file.
>> >
>>
>> You should be careful to avoid any string manipulation on possibly
>> translated
>> messages! For example, you might think its ok to just add them together
>> and
>> it might then look like it was correct in English, but some other
>> languages
>> can have other sentence structures and the thing you appended at the end
>> might need to be in the middle of the sentence in some other language or
>> it would be wrong.
>> I think, messages allow for parameters the translators can move around in
>> the translated sentence to avoid such problems. There are some helper
>> methods
>> for doing that and you should be able to find examples in code and the
>> message file.
>>
>> > > We also realized that this may lead to overlapping text or other
>> unexpected
>> > > formatting in the UI if the text becomes too long, especially if the
>> text
>> > > is in a button. Where should we look in the code to manage this?
>> >
>> > Hopefully wintertime can comment here. I try to keep away from UI
>> issues.
>> > Generally though, where the text gets too long it can often be
>> simplified
>> > by using a (small) image, particularly for goods.
>> >
>>
>> Swing widgets have automatic resizing, but for some elements it got
>> disabled
>> somehow in the code or constraints placed. FreeCol code is not consistent
>> in regards to that, so it depends on the parts you want to change.
>> Easiest is to just try it out (and it should also look well/be compatible
>> with
>> activated --gui-scale commant line option).
>>
>> > > Would it > be possible to dynamically change the size of panels and
>> buttons according
>> > > to the length of the text, or at least preserve text wrapping, if not
>> done
>> > > so already?
>> >
>> > I doubt it will be possible or desirable to change sizes of existing
>> > elements. IIRC FreeCol generally tries to have the full text for
>> buttons
>> > ready at the point of creation thus allowing the Java libraries to size
>> > them suitably.
>> >
>>
>> Yes, I'd try to avoid changing sizes, but some small adaptations might
>> turn out necessary. You better avoid putting too much text inside a
>> button,
>> as that would look strange.
>>
>>
>> Greetings,
>>
>> wintertime
>>
>> ------------------------------------------------------------
>> ------------------
>> _______________________________________________
>> Freecol-developers mailing list
>> Freecol-***@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/freecol-developers
>>
>
>
> ------------------------------------------------------------
> ------------------
>
> _______________________________________________
> Freecol-developers mailing list
> Freecol-***@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/freecol-developers
>
>
Dong Kim
2016-11-30 03:45:45 UTC
Permalink
Hi Caleb,

Awesome, I understand. Thanks for the help!

On Tue, Nov 29, 2016 at 10:30 PM, Caleb Williams <***@gmail.com> wrote:

> In looking at your question, we should be safe. It is up to the translator
> to make adjustments for local syntax. As long as the base string contains
> the variable (i.e. %priceTotal%), the language's syntax can be used.
>
> For example if the an American English phrase is: "The pineapple costs
> $2.00." and the string would be "costPineapple=The pineapple costs
> $%cost%." and the French string would be "costPineapple=L'ananas coûte
> %cost% $."
>
> Thanks,
>
> *Caleb R. Williams*
>
> On Tue, Nov 29, 2016 at 4:30 PM, Dong Kim <***@andrew.cmu.edu> wrote:
>
>> Hi again,
>>
>> Thank you for the pointers! We realized that the panels do resize for
>> longer JButtons. However, for the messages, I'm not entirely sure if I
>> understand how the main FreeColMessages.properties get translated to other
>> property files. As an example, I've added the following new key value pairs
>> in FreeColMessages.properties:
>>
>> negotiationDialog.euBuyPrice=(EU Buy Price: %priceTotal%)
>> negotiationDialog.euSalePrice=(EU Sale Price: %priceTotal%)
>> negotiationDialog.goldTrade=%amount% gold
>>
>> And modified the following key value pairs:
>>
>> buy.text=The %nation% would like to sell their %goods% for %gold%\n (EU
>> buy price: %euprice%):
>> sell.text=The %nation% would like to buy your %goods% for %gold%\n (EU
>> sale price: %euprice%):
>>
>> I've also made changes to the buttons displayed on the panel (i.e.
>> NegotiationDialog) such as:
>>
>> button.setText(Messages.message(item.getLabel()) + " " +
>> Messages.message(StringTemplate
>> .template("negotiationDialog.euSalePrice")
>> .addAmount("%priceTotal%", salePriceTotal)));
>>
>> Does this conflict with any sentence structures in other languages? In
>> the game, everything is working as planned, but we haven't been testing in
>> other languages.
>>
>> On Mon, Nov 28, 2016 at 7:21 AM, <***@genial.ms> wrote:
>>
>>> Hi,
>>>
>>>
>>> > Gesendet: Sonntag, 27. November 2016 um 22:07 Uhr
>>> > Von: "Michael T. Pope" <***@computer.org>
>>> > An: freecol-***@lists.sourceforge.net
>>> > Betreff: Re: [Freecol-developers] More Questions About #43
>>> >
>>> > On Sun, 27 Nov 2016 15:21:55 -0500
>>> > Dong Kim <***@andrew.cmu.edu> wrote:
>>> > > I had a few more questions about ticket #43. In order to display EU
>>> selling
>>> > > price, we are currently creating a new string to append
>>> > > to Messages.message(item.getLabel()), and were wondering if we
>>> would need
>>> > > to manually add Messages.key = value in all
>>> FreeColMessages.properties
>>> > > files in /data/strings, or just simply keep the appended string.
>>> >
>>> > FreeColMessages.properties is the master messages file. The
>>> translators
>>> > use that to make the internationalized versions thereof in
>>> > .../data/strings. Do not edit those, only the master messages file.
>>> >
>>>
>>> You should be careful to avoid any string manipulation on possibly
>>> translated
>>> messages! For example, you might think its ok to just add them together
>>> and
>>> it might then look like it was correct in English, but some other
>>> languages
>>> can have other sentence structures and the thing you appended at the end
>>> might need to be in the middle of the sentence in some other language or
>>> it would be wrong.
>>> I think, messages allow for parameters the translators can move around in
>>> the translated sentence to avoid such problems. There are some helper
>>> methods
>>> for doing that and you should be able to find examples in code and the
>>> message file.
>>>
>>> > > We also realized that this may lead to overlapping text or other
>>> unexpected
>>> > > formatting in the UI if the text becomes too long, especially if the
>>> text
>>> > > is in a button. Where should we look in the code to manage this?
>>> >
>>> > Hopefully wintertime can comment here. I try to keep away from UI
>>> issues.
>>> > Generally though, where the text gets too long it can often be
>>> simplified
>>> > by using a (small) image, particularly for goods.
>>> >
>>>
>>> Swing widgets have automatic resizing, but for some elements it got
>>> disabled
>>> somehow in the code or constraints placed. FreeCol code is not consistent
>>> in regards to that, so it depends on the parts you want to change.
>>> Easiest is to just try it out (and it should also look well/be
>>> compatible with
>>> activated --gui-scale commant line option).
>>>
>>> > > Would it > be possible to dynamically change the size of panels and
>>> buttons according
>>> > > to the length of the text, or at least preserve text wrapping, if
>>> not done
>>> > > so already?
>>> >
>>> > I doubt it will be possible or desirable to change sizes of existing
>>> > elements. IIRC FreeCol generally tries to have the full text for
>>> buttons
>>> > ready at the point of creation thus allowing the Java libraries to size
>>> > them suitably.
>>> >
>>>
>>> Yes, I'd try to avoid changing sizes, but some small adaptations might
>>> turn out necessary. You better avoid putting too much text inside a
>>> button,
>>> as that would look strange.
>>>
>>>
>>> Greetings,
>>>
>>> wintertime
>>>
>>> ------------------------------------------------------------
>>> ------------------
>>> _______________________________________________
>>> Freecol-developers mailing list
>>> Freecol-***@lists.sourceforge.net
>>> https://lists.sourceforge.net/lists/listinfo/freecol-developers
>>>
>>
>>
>> ------------------------------------------------------------
>> ------------------
>>
>> _______________________________________________
>> Freecol-developers mailing list
>> Freecol-***@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/freecol-developers
>>
>>
>
Loading...