|
|
Created:
July 20, 2018, 1:13 p.m. by anton Modified:
July 23, 2018, 4:02 p.m. CC:
René Jeschke Visibility:
Public. |
DescriptionIssue 6799 - Hebrew subscription is not installed for Hebrew locale
Patch Set 1 #
Total comments: 1
MessagesTotal messages: 9
LGTM
https://codereview.adblockplus.org/29835555/diff/29835556/adblock-android/src... File adblock-android/src/org/adblockplus/libadblockplus/android/AdblockEngine.java (right): https://codereview.adblockplus.org/29835555/diff/29835556/adblock-android/src... adblock-android/src/org/adblockplus/libadblockplus/android/AdblockEngine.java:88: } Looks good, but I believe that if you use Locale.getDefault().toLanguageTag(), it will already do the following conversions of legacy locales: iw -> he ji -> yi in -> id
On 2018/07/20 13:48:44, diegocarloslima wrote: > https://codereview.adblockplus.org/29835555/diff/29835556/adblock-android/src... > File > adblock-android/src/org/adblockplus/libadblockplus/android/AdblockEngine.java > (right): > > https://codereview.adblockplus.org/29835555/diff/29835556/adblock-android/src... > adblock-android/src/org/adblockplus/libadblockplus/android/AdblockEngine.java:88: > } > Looks good, but I believe that if you use Locale.getDefault().toLanguageTag(), > it will already do the following conversions of legacy locales: > iw -> he > ji -> yi > in -> id That's good but it's available starting android 21 only: https://developer.android.com/reference/java/util/Locale.html#toLanguageTag() This module requires 16 (https://github.com/adblockplus/libadblockplus-android/blob/master/adblock-and...) and we try not to increase api without need (some devs still require to lower it).
On 2018/07/20 13:55:23, anton wrote: > On 2018/07/20 13:48:44, diegocarloslima wrote: > > > https://codereview.adblockplus.org/29835555/diff/29835556/adblock-android/src... > > File > > adblock-android/src/org/adblockplus/libadblockplus/android/AdblockEngine.java > > (right): > > > > > https://codereview.adblockplus.org/29835555/diff/29835556/adblock-android/src... > > > adblock-android/src/org/adblockplus/libadblockplus/android/AdblockEngine.java:88: > > } > > Looks good, but I believe that if you use Locale.getDefault().toLanguageTag(), > > it will already do the following conversions of legacy locales: > > iw -> he > > ji -> yi > > in -> id *request to lower
On 2018/07/20 14:00:58, anton wrote: > On 2018/07/20 13:55:23, anton wrote: > > On 2018/07/20 13:48:44, diegocarloslima wrote: > > > > > > https://codereview.adblockplus.org/29835555/diff/29835556/adblock-android/src... > > > File > > > > adblock-android/src/org/adblockplus/libadblockplus/android/AdblockEngine.java > > > (right): > > > > > > > > > https://codereview.adblockplus.org/29835555/diff/29835556/adblock-android/src... > > > > > > adblock-android/src/org/adblockplus/libadblockplus/android/AdblockEngine.java:88: > > > } > > > Looks good, but I believe that if you use > Locale.getDefault().toLanguageTag(), > > > it will already do the following conversions of legacy locales: > > > iw -> he > > > ji -> yi > > > in -> id > > *request to lower I see... maybe extract this to a utility method (CompatUtils or inside this class), which uses a custom logic for devices below API 21 and for those over API 21 uses toLanguageTag()
On 2018/07/20 16:33:05, diegocarloslima wrote: > On 2018/07/20 14:00:58, anton wrote: > > On 2018/07/20 13:55:23, anton wrote: > > > On 2018/07/20 13:48:44, diegocarloslima wrote: > > > > > > > > > > https://codereview.adblockplus.org/29835555/diff/29835556/adblock-android/src... > > > > File > > > > > > adblock-android/src/org/adblockplus/libadblockplus/android/AdblockEngine.java > > > > (right): > > > > > > > > > > > > > > https://codereview.adblockplus.org/29835555/diff/29835556/adblock-android/src... > > > > > > > > > > adblock-android/src/org/adblockplus/libadblockplus/android/AdblockEngine.java:88: > > > > } > > > > Looks good, but I believe that if you use > > Locale.getDefault().toLanguageTag(), > > > > it will already do the following conversions of legacy locales: > > > > iw -> he > > > > ji -> yi > > > > in -> id > > > > *request to lower > > I see... maybe extract this to a utility method (CompatUtils or inside this > class), which uses a custom logic for devices below API 21 and for those over > API 21 uses toLanguageTag() I don't think it will be changed in android updates so i think just for simplicity we can just copy-paste the code from android sources (decompiled): ` public static LanguageTag parseLocale(BaseLocale var0, LocaleExtensions var1) { LanguageTag var2 = new LanguageTag(); String var3 = var0.getLanguage(); String var4 = var0.getScript(); String var5 = var0.getRegion(); String var6 = var0.getVariant(); boolean var7 = false; String var8 = null; if(isLanguage(var3)) { if(var3.equals("iw")) { var3 = "he"; } else if(var3.equals("ji")) { var3 = "yi"; } else if(var3.equals("in")) { var3 = "id"; } var2.language = var3; } `
On 2018/07/23 07:22:27, anton wrote: > On 2018/07/20 16:33:05, diegocarloslima wrote: > > On 2018/07/20 14:00:58, anton wrote: > > > On 2018/07/20 13:55:23, anton wrote: > > > > On 2018/07/20 13:48:44, diegocarloslima wrote: > > > > > > > > > > > > > > > https://codereview.adblockplus.org/29835555/diff/29835556/adblock-android/src... > > > > > File > > > > > > > > > adblock-android/src/org/adblockplus/libadblockplus/android/AdblockEngine.java > > > > > (right): > > > > > > > > > > > > > > > > > > > > https://codereview.adblockplus.org/29835555/diff/29835556/adblock-android/src... > > > > > > > > > > > > > > > adblock-android/src/org/adblockplus/libadblockplus/android/AdblockEngine.java:88: > > > > > } > > > > > Looks good, but I believe that if you use > > > Locale.getDefault().toLanguageTag(), > > > > > it will already do the following conversions of legacy locales: > > > > > iw -> he > > > > > ji -> yi > > > > > in -> id > > > > > > *request to lower > > > > I see... maybe extract this to a utility method (CompatUtils or inside this > > class), which uses a custom logic for devices below API 21 and for those over > > API 21 uses toLanguageTag() > > I don't think it will be changed in android updates so i think just for > simplicity we can just copy-paste the code from android sources (decompiled): > ` > public static LanguageTag parseLocale(BaseLocale var0, LocaleExtensions var1) { > LanguageTag var2 = new LanguageTag(); > String var3 = var0.getLanguage(); > String var4 = var0.getScript(); > String var5 = var0.getRegion(); > String var6 = var0.getVariant(); > boolean var7 = false; > String var8 = null; > if(isLanguage(var3)) { > if(var3.equals("iw")) { > var3 = "he"; > } else if(var3.equals("ji")) { > var3 = "yi"; > } else if(var3.equals("in")) { > var3 = "id"; > } > > var2.language = var3; > } > ` Since we don't have another subscriptions now i think we can just leave patch set #1
On 2018/07/23 07:31:17, anton wrote: > On 2018/07/23 07:22:27, anton wrote: > > On 2018/07/20 16:33:05, diegocarloslima wrote: > > > On 2018/07/20 14:00:58, anton wrote: > > > > On 2018/07/20 13:55:23, anton wrote: > > > > > On 2018/07/20 13:48:44, diegocarloslima wrote: > > > > > > > > > > > > > > > > > > > > > https://codereview.adblockplus.org/29835555/diff/29835556/adblock-android/src... > > > > > > File > > > > > > > > > > > > adblock-android/src/org/adblockplus/libadblockplus/android/AdblockEngine.java > > > > > > (right): > > > > > > > > > > > > > > > > > > > > > > > > > > > https://codereview.adblockplus.org/29835555/diff/29835556/adblock-android/src... > > > > > > > > > > > > > > > > > > > > > adblock-android/src/org/adblockplus/libadblockplus/android/AdblockEngine.java:88: > > > > > > } > > > > > > Looks good, but I believe that if you use > > > > Locale.getDefault().toLanguageTag(), > > > > > > it will already do the following conversions of legacy locales: > > > > > > iw -> he > > > > > > ji -> yi > > > > > > in -> id > > > > > > > > *request to lower > > > > > > I see... maybe extract this to a utility method (CompatUtils or inside this > > > class), which uses a custom logic for devices below API 21 and for those > over > > > API 21 uses toLanguageTag() > > > > I don't think it will be changed in android updates so i think just for > > simplicity we can just copy-paste the code from android sources (decompiled): > > ` > > public static LanguageTag parseLocale(BaseLocale var0, LocaleExtensions var1) > { > > LanguageTag var2 = new LanguageTag(); > > String var3 = var0.getLanguage(); > > String var4 = var0.getScript(); > > String var5 = var0.getRegion(); > > String var6 = var0.getVariant(); > > boolean var7 = false; > > String var8 = null; > > if(isLanguage(var3)) { > > if(var3.equals("iw")) { > > var3 = "he"; > > } else if(var3.equals("ji")) { > > var3 = "yi"; > > } else if(var3.equals("in")) { > > var3 = "id"; > > } > > > > var2.language = var3; > > } > > ` > > Since we don't have another subscriptions now i think we can just leave patch > set #1 ok, for sake of simplicity LGTM |