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

Bug 361816

Summary: Replace current NLS support with Text Provider Services
Product: z_Archived Reporter: Matthias Villiger <mvi>
Component: ScoutAssignee: Project Inbox <scout.core-inbox>
Status: CLOSED FIXED QA Contact:
Severity: enhancement    
Priority: P3 CC: zimmermann
Version: unspecified   
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard: migration
Bug Depends on:    
Bug Blocks: 361818    

Description Matthias Villiger CLA 2011-10-24 10:57:14 EDT
Currently the NLS support of scout is restricted to the NLS support based on .properies files (DynamicNls class).

- This should be extended with a generic Text Provider Service so that each project can decide how/where to store translations.
- Add a default implementation supporting the current .properties files.
- Add a generic API entry point (providing all texts in the project) so that developers no longer have to know which Texts instance they have to access.
Comment 1 Matthias Villiger CLA 2011-10-24 11:13:52 EDT
If we cleanup the translations in the scout rt, the current texts should be splitted into two separate plugins:

- in scout.rt.shared: all texts that are currently used by the scout runtime itself.
- in a scout.rt.shared.legacy.texts.fragment all texts that are currently not used by the scout runtime, but are still in the shared plugin translations. extract them into own plugin to allow clients that depend on these translations to keep access to them by adding the legacy.texts.fragment to the products.
Comment 2 Matthias Villiger CLA 2011-10-25 12:42:19 EDT
- added ITextProviderService, IDocumentationTextProviderService,
  AbstractDynamicNlsTextProviderService
- Migrated existing text providers to scout text provider services
- TEXTS class added for consistent translation retrieval
- Splitted org.eclipse.scout.rt.shared texts into two plugins:
  - org.eclipse.scout.rt.shared contains text provider service with all texts
    that are used by the runtime
  - org.eclipse.scout.rt.shared.legacy.texts.fragment contains all texts that
    are no longer used by the runtime
- getConfiguredDoc properties moved to different ConfigProperty type for Scout
  SDK (support for Docs Text Providers)
- ScoutTexts changed to use text services (cached).

Migration:
1. Add "org.eclipse.scout.rt.shared.legacy.texts.fragment" to all products if
   you use texts that have been moved to this plugin.
2. For each existing NLS Class (directly or indirectly
   extending "org.eclipse.scout.rt.shared.ScoutTexts"
   or "org.eclipse.scout.commons.nls.DynamicNls"):
  - create a new "<YourSharedPlugin>.services.common.text.
    <Name>TextProviderService" extending "org.eclipse.scout.rt.shared.services
    .common.text.AbstractDynamicNlsTextProviderService" in the corresponding
    shared plugin.
3. For each created TextProvider Service:
   - Overwrite the method "getDynamicNlsBaseName" and return the same value as
     in the "RESOURCE_BUNDLE_NAME" constant (stored in the corresponding Texts
     class) as string literal.
   - Register the service in the corresponding plugin as scout service using
     the "org.eclipse.scout.service.DefaultServiceFactory", no session class
     and give a ranking > 0.
     E.g.: <service class="com.bsiag.test.shared.core.services.common.
           text.CoreTextProviderService" factory="org.eclipse.scout.service.
           DefaultServiceFactory" ranking="100" />
4. Delete all Texts classes and replace all uses of the old Texts classes with
   the class "org.eclipse.scout.rt.shared.TEXTS".
5. Remove the "getNlsTexts" methods from the Session classes if existent
   (unless you use session-dependent translations).
6. Correct return type of "getConfiguredNlsProvider" of all SqlServices (if
   existent) to return the new type defined by AbstractSqlService and
   return "ScoutTexts.class" inside the method.
7. If somewhere the "SwingUtility.setNlsTexts" method
   or "SwtUtility.setNlsTextsOnDisplay" method is used, set it to
   "ScoutTexts.getInstance()".
8. Delete all .nls files (NLS Editor can now be accessed using the
   TextProviderService Node in the Scout Explorer of the Scout perspective).
   If you want to keep the .nls files (e.g. to support key shortcuts like
   ctrl+shift+r) do the following:
   - Open the .nls file in the text editor (right click -> open with).
   - Remove the following properties: "Nls-Type", "Nls-File-Prefix", "Nls
     Translation-Folder".
   - Change the property "Nls-Class" to the fully qualified name of the Text
     Provider Service you would like to edit with this .nls file.
   - Save the changes and open the .nls file again in the Multilanguage Editor
     (right click -> open with).
Comment 3 Matthias Zimmermann CLA 2012-07-09 06:50:25 EDT
ticket closed.
deliverd as part of eclipse scout 3.8.0 (juno release train)