📜 ⬆️ ⬇️

Amazon Music Innovative Localization Approach

Yesterday I put the Amazon Music application (50,000,000+ installations), but I could not start it. And this is despite the fact that I am their prime subscriber and live in the United States.

The following message appeared on the screen:


')


Yes, I really have Russian in the phone settings. But in my memory of using and developing for Android since Donut (1.6), nothing like this has yet been seen. Until now, I can not understand why they do not want to give the user the opportunity to run the application until he changes the system settings of his smartphone?


Does anyone have any idea how this prohibition can be dictated?

PS I don’t believe in the developers ’ignorance that in case of a language mismatch with the available broadcasts in Android, the strings.xml from the res / values folder will be automatically selected.

05/02 Update:
On the advice of kolipass pulled apk from the phone (using Es File Explorer). Then, with the help of an online decompiler, it was possible to unpack the source code reasonably well enough (it seems they don’t use proguard at all). But with strings.xml, he namudril and included there mainly translations from compat libraries and google play services .
Therefore, I had to run the good old apktool decompiler and it turned out ... that strings.xml they have quite a res / values daddy and all the English localization is there. At the same time, in the daddy values-ru lies the Russian!

But then everything cleared up from the BaseActivity.java and Market.java files :

class BaseActivity { ... if (!Market.isCountrySupported(getResources())) { String s = TAG; Object aobj[] = new Object[1]; aobj[0] = getClass().getName(); Log.warning(s, "Finishing %s due to unsupported locale", aobj); startActivity(InvalidLocaleActivity.getIntent(this)); finish(); } } class Market { static { US = new Market("US", 0, "ATVPDKIKX0DER", "ATVPDKIKX0DER", new String[] { "US" }); UK = new Market("UK", 1, "A1F83G8C2ARO7P", "A1F83G8C2ARO7P", new String[] { "UK", "GB" }); GERMANY = new Market("GERMANY", 2, "A1PA6795UKMFR9", "A1PA6795UKMFR9", new String[] { "DE", "AT", "CH" }); FRANCE = new Market("FRANCE", 3, "A13V1IB3VIYZZH", "A13V1IB3VIYZZH", new String[] { "FR" }); SPAIN = new Market("SPAIN", 4, "A1RKKUPIHCS9HS", "AJZF8LZ1EJVJN", new String[] { "ES" }); ITALY = new Market("ITALY", 5, "APJ6JRA9NG5V4", "A3HOBANJMCMD83", new String[] { "IT" }); JAPAN = new Market("JAPAN", 6, "A1VC38T7YXB528", "A1VC38T7YXB528", new String[] { "JP" }); CANADA = new Market("CANADA", 7, "A2EUQ1WTGCTBG2", "A2EUQ1WTGCTBG2", new String[] { "ZH" }); CHINA = new Market("CHINA", 8, "AAHKV2X7AFYLW", "AAHKV2X7AFYLW", new String[] { "CN" }); BRAZIL = new Market("BRAZIL", 9, "A2Q3Y263D00KWC", "A2Q3Y263D00KWC", new String[] { "BR" }); INDIA = new Market("INDIA", 10, "A21TJRUUN4KGV", "A2XZLSVIQ0F4JT", new String[] { "IN" }); MEXICO = new Market("MEXICO", 11, "A1AM78C64UM0Y8", "A3P3J5A7D2ZVXI", new String[] { "MX" }); AUSTRALIA = new Market("AUSTRALIA", 12, "A39IBJ37TRP1C6", "A1RNPCQ4K8U27I", new String[] { "AU" }); RUSSIA = new Market("RUSSIA", 13, "AD2EMQ3L3PG8S", "A38NPJYVS5YHNH", new String[] { "RU" }); NETHERLANDS = new Market("NETHERLANDS", 14, "A1805IZSGTT6HS", "A1M3WC0SJ3A38T", new String[] { "NL" }); Market amarket[] = new Market[15]; amarket[0] = US; amarket[1] = UK; amarket[2] = GERMANY; amarket[3] = FRANCE; amarket[4] = SPAIN; amarket[5] = ITALY; amarket[6] = JAPAN; amarket[7] = CANADA; amarket[8] = CHINA; amarket[9] = BRAZIL; amarket[10] = INDIA; amarket[11] = MEXICO; amarket[12] = AUSTRALIA; amarket[13] = RUSSIA; amarket[14] = NETHERLANDS; $VALUES = amarket; DEFAULT_MARKET = US; Market market = US; Market amarket1[] = new Market[6]; amarket1[0] = UK; amarket1[1] = GERMANY; amarket1[2] = FRANCE; amarket1[3] = SPAIN; amarket1[4] = ITALY; amarket1[5] = JAPAN; SUPPORTED_MARKETS = EnumSet.of(market, amarket1); LANGUAGE_TO_MARKET = new HashMap(16); LANGUAGE_TO_MARKET.put("en", US); LANGUAGE_TO_MARKET.put("de", GERMANY); LANGUAGE_TO_MARKET.put("fr", FRANCE); LANGUAGE_TO_MARKET.put("es", SPAIN); LANGUAGE_TO_MARKET.put("it", ITALY); LANGUAGE_TO_MARKET.put("ja", JAPAN); LANGUAGE_TO_MARKET.put("zh", CHINA); LANGUAGE_TO_MARKET.put("ru", RUSSIA); LANGUAGE_TO_MARKET.put("nl", NETHERLANDS); Market amarket2[] = values(); int i = (int)(0.5F + (float)(2 * amarket2.length) / 0.75F); int j = (int)(0.5F + (float)amarket2.length / 0.75F); OBFUSCATED_MARKET_TO_MARKET = new HashMap(i); COUNTRY_TO_MARKET = new HashMap(j); int k = amarket2.length; for (int l = 0; l < k; l++) { Market market1 = amarket2[l]; OBFUSCATED_MARKET_TO_MARKET.put(market1.mProdObfuscatedMarket, market1); OBFUSCATED_MARKET_TO_MARKET.put(market1.mDevoObfuscatedMarket, market1); String as[] = market1.mCountryCodes; int i1 = as.length; for (int j1 = 0; j1 < i1; j1++) { String s = as[j1]; COUNTRY_TO_MARKET.put(s.toUpperCase(Locale.ROOT), market1); } } } ... public static boolean isCountrySupported(Resources resources) { Locale locale = resources.getConfiguration().locale; Market market = (Market)COUNTRY_TO_MARKET.get(locale.getCountry().toUpperCase(Locale.ROOT)); return SUPPORTED_MARKETS.contains(market); } } 


In general, for my Market, they decided not to let the application run with the Russian locale. But I still do not understand why?

09/03 Update:
Finally, Amazon fixed the localization and admitted that it was a “pesky bug”:

Source: https://habr.com/ru/post/355452/


All Articles