View Single Post
Old 12-31-2011, 11:26 PM   #51
eureka
but forgot what it's like
eureka ought to be getting tired of karma fortunes by now.eureka ought to be getting tired of karma fortunes by now.eureka ought to be getting tired of karma fortunes by now.eureka ought to be getting tired of karma fortunes by now.eureka ought to be getting tired of karma fortunes by now.eureka ought to be getting tired of karma fortunes by now.eureka ought to be getting tired of karma fortunes by now.eureka ought to be getting tired of karma fortunes by now.eureka ought to be getting tired of karma fortunes by now.eureka ought to be getting tired of karma fortunes by now.eureka ought to be getting tired of karma fortunes by now.
 
Posts: 741
Karma: 2345678
Join Date: Dec 2011
Location: north (by northwest)
Device: Kindle Touch
Quote:
Originally Posted by ixtab View Post
- /var/local/locale/de-DE/: This is where the JavaScript-related parts referred to in my last message would go to. Because there is no "built-in" method for having the Kindle choose a correct version of these, I propose an upstart script which would automatically select the correct folder, use a "mount --bind" command to "override" the unlocalized strings with it. That script doesn't exist yet, but the effect should be along the lines of
Code:
mount --bind /var/local/locale/de-DE /usr/share/webkit-1.0/pillow/strings
Every time when Pillow app (i.e. appropriate HTML page) loads external resource (script or stylesheet), it is looking in a number of 'locales' subdirectories, starting from a directory of resource. For example, when HTML page 'search_bar.html', located at directory '/usr/share/webkit/pillow', requests script 'strings/str_table.js', it is initially looks for following directories: '/usr/share/webkit/pillow/strings/locales', '/usr/share/webkit/pillow/locales', '/usr/share/webkit/locales', ..., '/locales'. If one of these directories exists (first found wins), it is searched for a subdirectories with name of current locale. For example: if '/usr/share/webkit/pillow/strings/locales' has been found, it is searched for subdirectories 'en-us', 'en' (given that current locale is en_US). Again, first found subdirectory is selected for further processing. Then selected directory is searched for requested resource, i.e. file 'str_table.js'.

Long story short: create '/usr/share/webkit-1.0/pillow/strings/locales/en-us/' directory, copy there localized strings files, restart pillow (or select language again) and then (given that current/selected locale is en_US) you will see localized messages. I hope you'll get the point.

On locale change event (which is emitted, when user changes language) all Pillow apps are reloaded, and so their's resources.

This is could works for WAF apps also, as this mechanism is provided by underlying WebKit library.

Last edited by eureka; 12-31-2011 at 11:28 PM. Reason: clarification
eureka is offline   Reply With Quote