Bug 253116 - externalize strings for org.eclipse.mylyn.commons.*
Summary: externalize strings for org.eclipse.mylyn.commons.*
Status: RESOLVED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: Mylyn (show other bugs)
Version: dev   Edit
Hardware: PC All
: P4 enhancement (vote)
Target Milestone: 3.1   Edit
Assignee: Hiroyuki CLA
QA Contact:
URL:
Whiteboard:
Keywords: contributed
Depends on:
Blocks: 215116
  Show dependency tree
 
Reported: 2008-11-02 17:28 EST by Hiroyuki CLA
Modified: 2008-12-02 21:40 EST (History)
1 user (show)

See Also:


Attachments
org.eclipse.mylyn.commons.core.patch (18.02 KB, patch)
2008-11-02 17:29 EST, Hiroyuki CLA
no flags Details | Diff
org.eclipse.mylyn.commons.net.patch (69.96 KB, patch)
2008-11-02 17:29 EST, Hiroyuki CLA
no flags Details | Diff
org.eclipse.mylyn.commons.ui.patch (51.13 KB, patch)
2008-11-02 17:30 EST, Hiroyuki CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Hiroyuki CLA 2008-11-02 17:28:53 EST
The patch of externalize strings for org.eclipse.mylyn.commons.* HEAD
Comment 1 Hiroyuki CLA 2008-11-02 17:29:28 EST
Created attachment 116738 [details]
org.eclipse.mylyn.commons.core.patch
Comment 2 Hiroyuki CLA 2008-11-02 17:29:57 EST
Created attachment 116739 [details]
org.eclipse.mylyn.commons.net.patch
Comment 3 Hiroyuki CLA 2008-11-02 17:30:22 EST
Created attachment 116740 [details]
org.eclipse.mylyn.commons.ui.patch
Comment 4 Steffen Pingel CLA 2008-11-08 03:45:20 EST
I noticed that there are a few strings where different messages are used depending on quantity:

 if (minutes == 1) {
   min = minutes + Messages.DateUtil_minute_;
 } else if (minutes != 1) {
   min = minutes + Messages.DateUtil_minutes_;
 }

Do you know how to do this properly using ICU4J? I looked at PluralFormat but wasn't quite sure how to apply it and was wondering if it is actually used in the Eclipse platform?
Comment 5 Hiroyuki CLA 2008-11-08 04:37:20 EST
Original code:
			minutes = seconds / MIN;
			if (minutes == 1) {
				min = minutes + " minute ";
			} else if (minutes != 1) {
				min = minutes + " minutes ";
			}

I think that the mistake is found in the judgment of the minutes.
I think that the following judgments are correct. 
 
			if (minutes == 1) {
				min = minutes + " minute ";
			} else if (minutes > 0) {
				min = minutes + " minutes ";
			}

Ex of Output;
  0 minute  => ""   (None)
  1 minute  => "1 minute "
  2 minute  => "2 minutes "

This method does the following outputs.

1 hour 1 monute 1 secound
1 monute 1 secound
1 secound
2 hours 2 monutes 1 secounds
2 monutes 2 secounds
2 secounds
1 hour 2 secounds

Sorry, i don't use ICU4J.
Comment 6 Hiroyuki CLA 2008-11-08 05:02:55 EST
It is necessary to think about the date format for the internationalization. 
For example; 

Date format: MMM dd 

English:  Nov 08
Japanese:  11 08

When displaying in Japanese, should become "11/08". 

The following corrections are necessary to solve this problem. 

1) The method of the display is changed in the language
    (externalize strings of the date format), or

2) It changes to a common format. 
    (Ex;  MM/dd )

The uploaded patch only simply made the externalization. 
There is a problem also in the message text. 

English: This is BBB in AAA. 
Japanese: xxxx AAA xxxx BBB xxx.

The position of AAA and BBB in the sentence is different according to the language. 
The message should be buried and be edited when internationalizing it. 
Do not make the message by the string concatenation when internationalizing it. 

String word1 = "BBB";
String word2 = "AAA";
String message;

NG:  message = "This is " + word1 + " in " + word2 + ".";
OK:  Message = MessageFormat.format("This is {0} in {1}.", word1, word2);

After making to the externalization, I will make the correction of the date and the message. 
It is hoped that the patch is applied early. 
Comment 7 Steffen Pingel CLA 2008-11-08 17:07:11 EST
I have applied the patch for commons.core but moved the date formatting method to another plug-in to avoid having a message bundle in the class. 

I believe this would be the right way of formatting the message in this case:

 String Duration_format="0#{0} hours| 1#{0} hour | 1< {0} hours";

 ChoiceFormat fmt = new ChoiceFormat(Duration_format);
 System.out.println(MessageFormat.format(fmt.format(hours), hours));

The other two patches will require ip review.
Comment 8 Steffen Pingel CLA 2008-12-02 21:40:32 EST
Outstanding patches applied. I have moved all messages from the provisional to the internal package.

Thanks a lot Hiroyuki!
Comment 9 Steffen Pingel CLA 2008-12-02 21:40:55 EST
Marking resolved.