Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 390235

Summary: Remove string fragments from message bundles
Product: [ECD] Orion Reporter: Mark Macdonald <mamacdon>
Component: ClientAssignee: Mark Macdonald <mamacdon>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: gheorghe, simon_kaegi
Version: 1.0Keywords: helpwanted
Target Milestone: 7.0   
Hardware: PC   
OS: Windows 7   
Whiteboard:
Attachments:
Description Flags
messages patch none

Description Mark Macdonald CLA 2012-09-24 12:11:55 EDT
I found some code like this
> messages["Installed "] + plugin.getLocation()

The intent is to build a message by concatenating "Installed " and "http://whatever".

In general, this won't translate correctly into languages with different word ordering. Whenever a parameter needs to appear in a string we have to use a complete string and substitute the param like this:

 i18nUtil.formatMessage("Installed ${0}", plugin.getLocation());

This allows a message bundle to be written correctly for the language.
Comment 1 Mark Macdonald CLA 2012-09-24 12:17:39 EDT
Note that, when writing code that may eventually be translated, we should follow this pattern:

 (good) i18nUtil.formatMessage("Do you want to rename these ${0} files?", numFiles)

not this one:

 (bad) "Do you want to rename these " + numFiles + " files?" 

This makes the externalization process easier, because you don't have to clean up all the message fragments later.
Comment 2 Mark Macdonald CLA 2013-01-21 12:13:49 EST
Ok, to make this bug more concrete, here are the bundles that need to be fixed, and some examples of messages that may be wrong. There's probably lots of places I missed.

org.eclipse.orion.client.ui/web/orion/compare/nls/root/messages.js
 - "files changed"
org.eclipse.orion.client.ui/web/orion/edit/nls/root/messages.js
  - "Fetching ": "Fetching ",
  - "An error occurred: ": "An error occurred: ",
org.eclipse.orion.client.ui/web/orion/navigate/nls/root/messages.js
  - " is not supported in this file system"
org.eclipse.orion.client.ui/web/orion/nls/root/messages.js
 - " is already a favorite."
org.eclipse.orion.client.ui/web/orion/search/nls/root/messages.js
 - "Replaced "
 - " matches"
org.eclipse.orion.client.ui/web/orion/settings/nls/root/messages.js
 - "Installed "
 - "Installing "
 - " plugin"
 - "Are you sure you want to uninstall '"
org.eclipse.orion.client.ui/web/orion/widgets/nls/root/messages.js
 - " (Service Id: ": " (Service Id: "
 - "</a>": "</a>",
 - ">": ">",
Comment 3 Insoo Choo CLA 2014-09-11 13:52:54 EDT
Created attachment 246979 [details]
messages patch

Signed-off-by: Insoo Choo <earl93@hotmail.com>
Comment 4 Simon Kaegi CLA 2015-05-08 13:52:53 EDT
.