diff options
author | Parménides GV <parmegv@sdf.org> | 2015-04-15 10:41:59 +0200 |
---|---|---|
committer | Parménides GV <parmegv@sdf.org> | 2015-04-15 10:42:34 +0200 |
commit | c8994b645b607723bdaba4c2aa1ff0d19a9c0c13 (patch) | |
tree | 942129a0870fce168fcb788fa5d7ec21b7fae5bc | |
parent | e522e5e325e6ed19b1316fd251f3c212a2344d7c (diff) |
Set accept-language in ProviderAPI, language-country
String locale = Locale.getDefault().getLanguage() + Locale.getDefault().getCountry();
4 files changed, 4 insertions, 32 deletions
diff --git a/app/src/debug/java/se/leap/bitmaskclient/ProviderAPI.java b/app/src/debug/java/se/leap/bitmaskclient/ProviderAPI.java index b0df5ab8..9b5601a9 100644 --- a/app/src/debug/java/se/leap/bitmaskclient/ProviderAPI.java +++ b/app/src/debug/java/se/leap/bitmaskclient/ProviderAPI.java @@ -423,6 +423,8 @@ public class ProviderAPI extends IntentService { InputStream is = null; urlConnection = (HttpsURLConnection) new URL(url).openConnection(); urlConnection.setRequestMethod(request_method); + String locale = Locale.getDefault().getLanguage() + Locale.getDefault().getCountry(); + urlConnection.setRequestProperty("Accept-Language", locale); urlConnection.setChunkedStreamingMode(0); urlConnection.setSSLSocketFactory(getProviderSSLSocketFactory()); diff --git a/app/src/main/java/se/leap/bitmaskclient/UserSessionStatus.java b/app/src/main/java/se/leap/bitmaskclient/UserSessionStatus.java index a767ec97..28c7ecc7 100644 --- a/app/src/main/java/se/leap/bitmaskclient/UserSessionStatus.java +++ b/app/src/main/java/se/leap/bitmaskclient/UserSessionStatus.java @@ -106,18 +106,4 @@ public class UserSessionStatus extends Observable { private String capitalize(String to_be_capitalized) { return to_be_capitalized.substring(0,1).toUpperCase() + to_be_capitalized.substring(1); } - - private String conjugateToBe(String subject) { - String conjugation = ""; - String[] personal_pronouns = resources.getStringArray(R.array.personal_pronouns); - String[] verb_to_be = resources.getStringArray(R.array.verb_to_be); - for (int i = 0; i < personal_pronouns.length ; i++) - if(subject.equalsIgnoreCase(personal_pronouns[i])) { - conjugation = verb_to_be[i]; - break; - } - if(conjugation.isEmpty()) conjugation = verb_to_be[User.DEFAULT_CONJUGATION_PERSON]; - - return conjugation; - } } diff --git a/app/src/main/res/values-es/arrays.xml b/app/src/main/res/values-es/arrays.xml index 731330b2..045e125f 100644 --- a/app/src/main/res/values-es/arrays.xml +++ b/app/src/main/res/values-es/arrays.xml @@ -1,21 +1,3 @@ <?xml version="1.0" encoding="utf-8"?> <resources> - <!-- Keep the order the same as the TYPE_ constants in VPNProfile --> - <string-array name="verb_to_be"> - <item>soy</item> - <item>estás</item> - <item>está</item> - <item>estamos</item> - <item>estáis</item> - <item>están</item> - </string-array> - - <string-array name="personal_pronouns"> - <item>Yo</item> - <item>Tú</item> - <item>Él</item> - <item>Nosotros</item> - <item>Vosotros</item> - <item>Ellos</item> - </string-array> </resources> diff --git a/app/src/release/java/se/leap/bitmaskclient/ProviderAPI.java b/app/src/release/java/se/leap/bitmaskclient/ProviderAPI.java index 24e7df20..890262ce 100644 --- a/app/src/release/java/se/leap/bitmaskclient/ProviderAPI.java +++ b/app/src/release/java/se/leap/bitmaskclient/ProviderAPI.java @@ -416,6 +416,8 @@ public class ProviderAPI extends IntentService { InputStream is = null; urlConnection = (HttpsURLConnection) new URL(url).openConnection(); urlConnection.setRequestMethod(request_method); + String locale = Locale.getDefault().getLanguage() + Locale.getDefault().getCountry(); + urlConnection.setRequestProperty("Accept-Language", locale); urlConnection.setChunkedStreamingMode(0); urlConnection.setSSLSocketFactory(getProviderSSLSocketFactory()); |