export android application for one locale - android

I have to maintain an application which has strings, images, videos in different language it makes a heavy apk and I would like to know if I could tell the exporter to only package only resource applying to one specific locale ?
imagine I have the files
res/values/strings.xml
res/values-en/strings.xml
res/values-it/strings.xml
res/values-fr/strings.xml
And I want to generate and apk with only italian only
res/values/strings.xml
res/values-it/strings.xml
(and maybe force generated app to use italian as locale)
Actually I have 2 projects for 2 locales us / it, everthing is dupplicated, so everytime I have to edit a java or xml file I have to edit it twice.
Now I am required to create a 3rd apps for french and I don't want to copy paste to a new app and to maintain 3 times the same files ! (and more in the future)
I wanted to merge everything into a single apk and then export for one locale because the client require 1 apk per country
I don't know how I could refactor the apps to simplify my works my idea is to export for one locale
thanks for help

I think you could do this with Android Studio and Gradle but it would take some possibly complicated (for a Gradle beginner) setting up of the Source Sets folders.
http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Product-flavors

Related

How to localize Android app name in Marmalade SDK

I am developing an app for Android using Marmalade 8.2 and I want to have a translation of my app's name in different languages.
I know that I can change the app's name in the deployment options of the MKB file:
name = "My Name"
caption = "My Name"
So one way to do it would be to create different deployments (one for each language), but then I would end up with several different APKs.
Another way would be to use the: android-extra-strings deployment option as something like this:
android-extra-strings='(app_name,My App Name)'
But once again I would have to create different deployments for different languages.
Is there a way to specify different strings.xml files in Marmalade or to have localized strings in the same deployment?
UPDATE
I've done some more reasearch and I discovered that I can add extra strings.xml files to my apk package. Each of these files can have a localized app name.
To do this I've added the following step to my configuration: android-external-res = "android_res", unfortunately the folders with the strings.xml are not being copied into the apk. I am doing something wrong?
I've done some more testing and the android-external-res = "android_res" variable in the MKB file works fine as long as you have the correct folder structure with the values-xx folders (xx would be the language code such as en or pt) and the strings.xml files inside them.
Note: even though he package is built with these files and they work, you will not seem them in the "intermediate-files" folder of your build, so you can end up thinking that they are being disregarded.

Create Android app in multiple languages

I have submitted an Android app to Google Play and I see that I can create different descriptions for each language it supports. My question is: can I create a different APK for each language? Alternatively, how can I detect the user's preferred language, so that I can automatically activate that language for the user in the app?
Here is the official tutorial for localizing your app. :)
You can create a different apk for each language ( split-apk ) - but I would not recommend this. Better use the platform function for this and put your strings file in the right path ( values- ) - after this everything is automagically done
no just use the /res/values/strings.xml
for example to choose english language create a folder in same directory of values and call it values-en, for frensh values-fr and so on. the default language of the app is under values/
And if (for some reason) you still need to know witch is the devices language use
Locale.getDefault().getDisplayLanguage();

Android adding additional languages after app is installed

I have placed the resources to support different languages in appropriate packages as suggested in Android Localization documentation. Is there a way to add additional languages, i.e, resources after the app is installed without having to download and re-install the app. I mean updating the app - adding new resources and even updating some existing ones.
For example if my app initially supported English and French. Now suppose I want to add new language say Hindi and update few of the resources in English. So what is the approach..?
I had this issue, my approach is to create separate folder on the device \data\packageName\languages\
there will be one file called supportedfiles.lang the format of the file will be
English en
Russian ru
...
also in same location you will have the following files
en.lang
ru.lang
the format of each language file ie(en.lang / ru.lang) will be like regular strings.xml
Some text
when you load the application in settings screen you will read the supportedfiles.lang and show to user the supported languages when he choose different language you just need to load the appropriate language file
Maybe it is over kill, but you will have the flexibility to support other languages while the application installed without updating the application just copy the files into /data/package/languages/

How can change name of project and package?

I am developing an Android application named "English SMS Collection" in Google Play store, and now I want to upload this app in Hindi language also. So what changes are required to previous APK?
How to add another language to an Android application? And also what image size icons are required for uploading the app to market?
Any help would be appreciated.
Generally, splitting the same app into two functionally equivalent versions with different languages is a bad idea.
If you absolutely must do that, the only thing you need to change is the package name (package="com.example.project") in your AndroidManifest.xml (no need to rename actual packages, just that one string in manifest).
Also, if your Activities are declared relatively to app's package (e.g. .MyActivity as opposed to com.mypackage.activities.MyActivity) - and they most likely are - changing app's package name will obviously cause FCs because you effectively rename the activities. So to be able to switch the package name back and forth you'll have to detach Activity names from app's package by declaring them absolutely (e.g. com.mypackage.activities.MyActivity)
Here's a comprehensive guide on icons from Google, next time please do more research before asking such simple questions: Iconography
Also, judging by the question, you'll probably want to also read into this: Publishing Checklist for Google Play
Please DO NOT split your app up into two apks just because of the language. This is very bad style.
According to the android devleoper's guide, it's best practice to create ressource-folders with so called "configuration qualifiers". Your strings (e.g. text) should all be stored in the file /res/values/strings.xml . This is the default setup (without a configuration qualifier), when adding localized translations you have to create a new folder and strings.xml file /res/values-cc/strings.xml where cc has to be the standardized country/language code (e.g. "en" for english, "de" for german, "cs" for czech...).
For more (essential) informations on this, visit developer.android.com/guide/topics/resources/localization.html .
You need to change the package name because it should be unique while uploading in market. It can be signed with the same keystore file you have done for other two apps. Obviously, you have to change the Application name and its icon.
For more Information on Publishing Checklist for Android Apps, check this documentation.
In a Package Explorer, click on the package name (e.g: com.example.android), right-click and go to Refactor. Choose the Rename... option there.

Localizing Titanium Android application

I have a completed Titanium Android application (that the developer was not me).
I want to localize it but both the strings and the UI are hard coded in the source code.
The application built in javascript.
The UI is also important because we also want a right-to-left version of the app.
Need to mention that I'm pretty new to the Titanium environment.
What is the best approach to this task?
You would need to take the source code and find all the hard coded strings and move them to the il8n/ folder's string.xml file. You would need to create one of these files in the appropriate language directory with the string that corresponds to the particular hard coded value you want to represent.
For example:
var mystring = L('hi_text');
In Titanium, this code would go to the language folder (of the device's setting, i.e. English or en folder) and look for an entry like this:
il8n/en folder:
<string name="hi_text">Hello</string>
If the device was in Spanish language mode, that same code would then look to the il8n/es folder:
<string name="hi_text">Hola<string>
That would allow you to switch the language, but changing the UI would likely be a significant change to the source code. In the app.js file, you may attempt to detect the language of the device and branch to completely different logic for the screens. You could also do this in the particular screen javascript files as well, where you call one creation function for each different language. You will likely be changing the architecture of the application if it didn't already have that requirement built-in.
Here is the official document :
https://developer.appcelerator.com/question/125732/localization-not-working

Categories

Resources