Many android applications have quite poor i18n-support, and for an understandable reason, as it adds much work for the developer.
From a both intuitive and cultural point of view it would be a good thing if end-users could translate the apps themself, and OTA share the translation, without reinstalling the app itself.
In concept; as wikipedia, some add content easily, others only use what's there.
It's of course important that the service is as easy as possible to use, both for app-developers, and people willing to transcribe.
To keep it simple, this is the solution I'm concidering;
Developer perspective:
Developer uses a customized setContentView when open activities/layouts that will seach for thanslations of xml-entries. (below)
The customized version is provided as a free downloadable library/class..., turning the i18n feature to more or less a one liner.
User perspective:
User downloads app without any translation
As app launches, it checks locale running at phone, and will look for a translated xml-file at shared space in SD.
If no or old transcribed xml (above), try to download new from internet-service (ansync). This is all done by library above, no need for intents.
Translator perspective:
- Separate app to provide translations for any app using the i18n service above. (Could be just a webapp), with some form of QA on translators/input.
QUESTION: Now, for this to work efficiently, it has to be AeasyAP for the developer to even bother, and the most fluent solution would be a customized version of setContentView, that simply loads the translated values from external xml, instead of the ones in the apk.
Is this possible at all, and if not, what's your suggested solutions?
(And of course, Happy New Year, feliz ano novo, blwyddyn newydd dda, Gott Nytt År, kontan ane nouvo, szczęśliwego nowego roku ...)
Regards, /T
Regarding the second part of the question, it is possible to use an existing translation service like Launchpad, which operates on .po files for gettext. There is however android2po, which can transform between Android's XML and the gettext .po format.
There are already some Android translations on Launchpad, e.g. ConnectBot, however the service requires a login to be able to contribute. Alternatively, you should look at the available gettext-based web translator suites you can run yourself as well, like Pootle.
Sorry, I am not allowed to post more than one URL. Please google the rest up :(
Yes, it's possible only if someone (probably you or me or others) will rewrite
setContentView()
- since I see root of a problem only there. Let me explain:setContentView
How to do that? 2 options:
OwnActivity
class which will redefinesetContentView(int id)
. For instance:OwnActivity.setContentView()
looks inside SQLite for known XML id with current locale, if not found it inflates XML from res/layoutEDIT1:
You can override it like:
layoutinflator.factory is what I was looking for...