Android App Localisation - Downloading translations at runtime - android

I'm working on an app that needs to support a large number of languages. Instead of bundling all languages in the app resources, I want to be able to download the language when the user selects a new language from the settings menu.
The Facebook mobile app does this very well. If you are logged in, go to settings> languages > switch language > pick a different language.
I think Facebook are downloading these language resources, Because if i put my phone into airplane mode , it doesn't work ( prompted with try again, or use english as default).
Since the app resources can't be edited at runtime, i'm guessing Facebook are using a database to download the language , then load the translations from there?!
p.s i'm actually trying to do this in Xamarin...trying to understand the Facebook Android approach so I can implement it myself.

I don't know specifically about Facebook, but I know this technique is in use by some people -- I've seen presentations on similar setups from other companies. There are a couple of obvious benefits:
Reduce overall app size by not bundling 30 languages worth of strings.
The ability to improve localized strings without forcing the user to download an app update.
Better data about what languages your users are using.
When I've seen in presented (again, this was not Facebook specifically), it worked much as you suggested -- user selects the preferred language, app fetches a string bundle from the server, then starts using it. Once the language is set, the app can even periodically refresh the localized string bundle to get updates.
However, there are some downsides to be aware of, especially if the localized strings change over time. It can make support tricky -- if a string has changed, a button (for example) might be called different things depending on exactly when the user was using the app. It also will really put pressure on your i18n strategy and QA to make sure the UI looks decent with strings that might be changing frequently.

If you download localization files you will not be able to use the default localization support within Android.
If you do go ahead with this strategy (downloading of localization files), you will need to create your own class to manage this or alternatively, search for a library which does this for you.

Related

Different Apps within the same app

i developed an app that contains a lot of activities and different application within the same app and they are all interconnected by sending different intents within it to function the whole app, however they still do different things and i can elimante one without hurting the other and causing the whole app to crash. so if i want i can divide them to be stand alone apps.
My question is this:
Can i have one app that download the basic activities and if a person want a specific activity they can download it (Eg: you download a game and that game includes a different set of levels that can be downloaded by pressing a button hence downloads that particular set of levels.)?
Forgive me if I misunderstood you, but are you talking about creating one big app that consists of many smaller apps, but rather than being all bundled in the beginning, a user can download each one as a module?
If it's this, it's not impossible, but not possible in the sense that I think you're hoping for.
Your one big app will still need all the necessary code and xml files because these need to exist when compiling. But what you can do, which is similar to what games do is to offer downloadable content that isn't code. Essentially, these are resources such as media files, text, or other data of the like.
Those data can be downloaded separately without affecting your app and it helps reduce the size of your app. However, the actual functionality of each individual app will still need to be within your app, but hidden until it's downloaded.
Typically, it's more common to just bundle it all together such as a Measurements app, or to have them as individual standalone apps such as Google Docs, Sheets, and Slides.
You're basically describing how a browser/website works.
If you really wanted to wrap this up as a mobile app, you could use webviews.

Is app localization implemented at download time or runtime?

For iOS and Android apps that are designed with regional/language localization, I want to know: Are all of the different localized strings, etc. downloaded onto the user's device when purchasing from the app store, or is it already optimized for file size, by only downloading those that match the user's regional/language settings at the time of purchase?
If it's the former (everything is downloaded onto the device and then the localization is implemented at runtime), then that will be a big problem for me. My app relies on a very large database of text, which needs to be in the user device's language. Having all of the different language versions at the same time will take up a ton of space. So, that means either I have to: 1) have a monster app file size, or 2) have to release a different instance of the app in each language, neither of which is ideal (though I can live with the second option if I have to). Or is there some other way?
Even though I'm still a long way from release I need to start thinking about this because it will affect the way I organize things going forward.
You have to set it in your app, so i don't think that app thining process takes care of that.
If you have a large base of texts you should consider creating a service for it and fetch texts from that service when needed, based on your device language or a user preference (language menu) if you have it in the app.

Android: Change Languages (string.xml) programmatically

In our Android app, we have an option for the user to change the language, which means he can select whether he want to use English or Sinhala. The default is always in English. We have one string.xml for English and another for Sinhala.
I was referring Android documents about "localization" but that is not exactly what I am looking for, I can't ask the user to change his phone settings. I also noticed programmatic localization which is discussed in here but most users do not recommend it due to loads of errors (anyway these posts are pretty old)
So, what's the best way of changing the String?XML file, with the preferred language of a user? It seems not easy on Android.
Or, is this is simply not a good idea?

Extend my android app in different APK

I am developing an application that should be extendable
I want the user to install the base app and then extend it by installing extension packs (different APKs) or plug-ins (like go launcher and theme-packs or add-on widgets)
The only thing I could find is using library project to share the code but that doesn't fit my needs. Can someone explain how its done?
[edit]
To be more specific, here is what I want to do:
I have a set of animated scenes, effects and transitions
animated scene is a combination of code and resources
The user can select the 1st scene, 2nd scene etc..
I wish to be able to add more scenes but I don't want to include them all in one APK
I want to let the user download scenes of his choice.
To build this type of interaction, ContentProvider will be your friend. There are two options I can think of to build this type of system, depending on which direction you would like information to flow.
Option 1: Single ContentProvider in main application
Define a ContentProvider in your main application, which creates an external interface for other applications to read/write data to a common location. This provider maintains access to the scene data files/database your application needs.
Each subsequent plugin application accesses the main ContentProvider (and also warns the user if they run a plugin but haven't installed the main app yet) and installs its specific content by writing it to the ContentProvider. In this way, each plugin is designed to act as an "installer", meaning the user has to download and run the plugin from Market to install the scene content.
Option 2: Each "Plugin" application has its own ContentProvider
This option is the reverse of the above. Define a ContentProvider with a consistent interface in each plugin application and have a method from the main application that scans the system for new plugins (this can be done via PackageManager) and reads the data from each provider into its main local store.
The difference here is that the user won't have to run each plugin package, because the main application will take care of getting the data. However, there's more complexity in defining multiple providers. For instance, you have to make sure that, even if each provider has the same basic interface, they cannot have a single common authority, so you will have to scan the system for package names like your own and resolve the providers based on that information.
Editorial
Having said that, I feel I should mention that I don't believe this is a good method of providing content to your users. My personal feeling on the subject is this method pollutes the user's devices with application icons that do them no good, and it's difficult to hide that kind of thing on the mobile device. A simpler, and much cleaner approach to this would be to store your "add-on" content on a server (AWS services like S3 and SimpleDB are practically free) and use a service like Google's In-App Billing to let your users purchase the new content and download it directly into the single application rather than having them go back to Market and purchase more apps.
Hope that Helps!
I have a set of animated scenes, effects and transitions animated scene is a combination of code and resources The user can select the 1st scene, 2nd scene etc..
If the "animated scenes" are activities. your add-on APKs simply publish their own sets of activities, and you use PackageManager to determine which of your plugins are installed and how to use them.

Android Forced Localization and App Icon/Label?

I have an unusual problem. I need to force-localize an app -- i.e., force it to load in a specific language, regardless of the phone's language setting.
What our client wants basically is to create language-specific builds of our app. We have all of the resources defined for different languages, and can therefore build an app that will automatically localize based on the phone's settings. But he also wants separate builds for specific languages. Before you say it: yes, I know that this is fighting against Android's Localization system. Yes, we did explain that and try to talk him out of it. But this is what he wants, so it's what we have to do.
I have found some good tutorials on doing this using Locale.setDefault() and the android:configChanges="locale" tag in the Manifest, and that seems to work just fine for setting the language inside Activities. But it has one shortcoming: it doesn't effect the app icon or the app label (i.e., what shows in the launcher), because those are retrieved from the Manifest at compile time.
So I'm trying to find the easiest way to handle this. I know if all else fails, I can write a Bash script that will just move the localized versions of those resources into the default directory before compiling. And if it comes to that, that's what I'll do. But I want to see first if there is a more elegant way that I'm overlooking.
Anyone have any suggestions?

Categories

Resources