Search code examples
androidinternationalizationandroid-resources

How can I have both res/values-pt_PT and res/values-pt_BR on Android?


I keep getting an error when creating folders for internationalization. But the errors appear just for folders with the name like values-xx_XX. If I have values-xx everything is ok, but like I asked in the title I want to make 2 separate folders for the (aprox.)the same language: values-pt_PT,values-pt_BR. How can I do that without getting any errors? Note: The error is not specified anywhere, the eclipse is just marking the folder with a red cross and doesn't allow me to run the project.

Every hint is appreciated. Thank you! :)


Solution

  • Use the format values-xx-rXX instead of values-xx_XX. In this instance you should use values-pt-rPT and values-pt-rBR.

    See http://developer.android.com/guide/topics/resources/providing-resources.html#AlternativeResources

    The language is defined by a two-letter ISO 639-1 language code, optionally followed by a two letter ISO 3166-1-alpha-2 region code (preceded by lowercase "r").