On 20/09/13 13:29 , Henri Sivonen wrote:
I don't happen to have multi-locale Android or B2G builds set up, but
I need to know how they behave to avoid breaking them. Does anyone
happen to know if the following code would end up printing the locale
code for the active browser UI localization on Android and B2G despite
them not being XUL platforms?

#include "nsIChromeRegistry.h"
#include "mozilla/Services.h"

   nsAutoCString locale;
   nsCOMPtr<nsIXULChromeRegistry> registry =
     mozilla::services::GetXULChromeRegistryService();
   if (registry) {
     registry->GetSelectedLocale(NS_LITERAL_CSTRING("global"), locale);
   }

printf("LOCALE: %s\n", locale.get());


It's implemented by the same bits as the ToolkitChromeRegistry and the ChromeRegistry:

http://mxr.mozilla.org/mozilla-central/source/chrome/src/nsChromeRegistry.cpp#106

http://mxr.mozilla.org/mozilla-central/source/chrome/src/nsChromeRegistryChrome.cpp#270

(AFAIK this is the only implementation of those registries)

Both Android and B2G rely on chrome:// URLs. Unless something changed recently, those don't work without the chrome registry, so yes, I would expect this to work on B2G/Android, too.

~ Gijs
_______________________________________________
dev-platform mailing list
dev-platform@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-platform

Reply via email to