Internalization

The Android Software Development Kit offers great built-in support for¬†internalization. It is easy to get started and make your app support several languages. Under the resources (res) folder you create subfolders for values with different suffixes i.e. values-fi, values-de, values-se and the resources you place under those folder will automatically be used depending on the user’s language setting. Values folder, without any suffixes is used if nothing else is specified, so it is the standard folder.

res/
  values/
     strings.xml
  values-fi/
     strings.xml
  values-de/
     strings.xml
  values-se/
     strings.xml

Lint even analyzes code for bidirectional text, to support languages that are written from right-to-left. It is an easy oversight at an early phase of the development process, but one that you will cost you a lot of tricky decisions down the line. If you are heading directly to international markets and releasing your app in several countries, it’s good to keep this in mind. Though designing layouts with a lot of spare room can difficult, often times you need to have your text resources customized to even fit. This means translating the texts, not only based on context, but also keeping in mind those precious Density-independent pixels.

This brings about the arduous task of going through the layouts after each iterative change,  so keeping you language support somewhat limited will save you a lot of time further on.

Analyzing code with lint

Lint is a tool that analyzes your code for several different purposes. You can start the built in lint tool from Analyze > Inspect Code. Which prompts a selection where you can select the part of the project you want to inspect.

lint
Select what to analyze

You can customize the Inspection Profile to a great degree and make different kind of inspection profiles. The default profile is a good place to start, because it will cover many different aspects of the project and covers certainly for someone starting to use lint.

 

lint-inspections
Configuring inspections

After you run lint, you will get the results in the bottom. You can go through the lists and select individual errors, if you right click the error, lint offers you few options for example exclude or suppress lint annotation. Suppress lint for example will add an annotation, so in the future lint will not report the same error if it was unnecessary.

lint-tool
Lint categories

Lint is a great tool, especially for finding unnecessary code and other pretty straightforward errors. In practice you will often see errors that are not actual errors, so proceed using lint with care. It is first good to fix one error at a time and run the app after the fixes so you get a feel for what kind of errors lint is best suited for. You will get quite a bit of unnecessary error reports also, by running lint in a few different projects you will get to know what lint is best suited for.