Community
Participate
Working Groups
The patch of externalize strings for org.eclipse.mylyn.commons.* HEAD
Created attachment 116738 [details] org.eclipse.mylyn.commons.core.patch
Created attachment 116739 [details] org.eclipse.mylyn.commons.net.patch
Created attachment 116740 [details] org.eclipse.mylyn.commons.ui.patch
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?
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.
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.
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.
Outstanding patches applied. I have moved all messages from the provisional to the internal package. Thanks a lot Hiroyuki!
Marking resolved.