From c8994b645b607723bdaba4c2aa1ff0d19a9c0c13 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Parm=C3=A9nides=20GV?= Date: Wed, 15 Apr 2015 10:41:59 +0200 Subject: Set accept-language in ProviderAPI, language-country String locale = Locale.getDefault().getLanguage() + Locale.getDefault().getCountry(); --- .../debug/java/se/leap/bitmaskclient/ProviderAPI.java | 2 ++ .../java/se/leap/bitmaskclient/UserSessionStatus.java | 14 -------------- app/src/main/res/values-es/arrays.xml | 18 ------------------ .../java/se/leap/bitmaskclient/ProviderAPI.java | 2 ++ 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 @@ - - - soy - estás - está - estamos - estáis - están - - - - Yo - - Él - Nosotros - Vosotros - Ellos - 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()); -- cgit v1.2.3