Bug 298360 - [fiximprove][localization]: Local Locale with Default Locale Fallback - request
Summary: [fiximprove][localization]: Local Locale with Default Locale Fallback - request
Status: RESOLVED DUPLICATE of bug 301332
Alias: None
Product: MTJ (Archived)
Classification: Tools
Component: Core (show other bugs)
Version: 1.0.1   Edit
Hardware: All All
: P3 enhancement (vote)
Target Milestone: Future   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords: ui
Depends on:
Blocks:
 
Reported: 2009-12-21 17:48 EST by Mario CLA
Modified: 2010-06-25 08:08 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Mario CLA 2009-12-21 17:48:19 EST
[Not sure what component the localization support belongs to, so filing it Pulsar - sorry if I am wrong]

I enabled localization (http://help.eclipse.org/galileo/topic/org.eclipse.mtj.doc.user/html/gettingstarted/localization.html) which works fine under limitations.

Basically, as long as the 'required' localisation exists, everything is fine.
I'ld prefer to see 'fallback' support.  What I mean, is that if a localized string does not exist, the default is used.

I modified 'L10nResources.java' because the documentation only said not to touch the 'L10nConstants.java'.  Unfortunately 'L10nResrouces.java' is rewritten too.

What did I change?

Basically, I changed the interface of ReadResources to include 'values'.
Hence, 'values = readResources(reader)', became 'readResources(reader, values);'.
Further, in 'setLocale', I added a protected call to 'this.loadResources(L10nResources.DEFAULT_LOCALE);' before the protected call to 'this.loadResources(this.locale);'.

The result?

The default locale gets loaded first.  That locale should have all strings.  Then, an attempt is made to load the 'local locale'.  If it does not exist, no real harm is done, the default locale is fully in place.  If it exists, then any string defined in the 'local locale' overrides the one from the 'default locale'.

Please implement something similar.
Comment 1 Gorkem Ercan CLA 2010-06-25 08:08:47 EDT
The main problem is what happens when a key is not found is intrusive at the moment. We are fixing this with bug 301332. After the fix the missing keys will not throw exceptions or return null.  But you will be able to spot them easily...

*** This bug has been marked as a duplicate of bug 301332 ***