diff --git a/app/src/main/java/org/schabi/newpipe/MainActivity.java b/app/src/main/java/org/schabi/newpipe/MainActivity.java
index cac814085..05e224013 100644
--- a/app/src/main/java/org/schabi/newpipe/MainActivity.java
+++ b/app/src/main/java/org/schabi/newpipe/MainActivity.java
@@ -56,7 +56,6 @@ import androidx.fragment.app.FragmentManager;
import com.google.android.material.navigation.NavigationView;
import org.schabi.newpipe.extractor.NewPipe;
-import org.schabi.newpipe.extractor.ServiceList;
import org.schabi.newpipe.extractor.StreamingService;
import org.schabi.newpipe.extractor.exceptions.ExtractionException;
import org.schabi.newpipe.extractor.services.peertube.PeertubeInstance;
@@ -67,7 +66,6 @@ import org.schabi.newpipe.fragments.list.search.SearchFragment;
import org.schabi.newpipe.report.ErrorActivity;
import org.schabi.newpipe.util.Constants;
import org.schabi.newpipe.util.KioskTranslator;
-import org.schabi.newpipe.util.Localization;
import org.schabi.newpipe.util.NavigationHelper;
import org.schabi.newpipe.util.PeertubeHelper;
import org.schabi.newpipe.util.PermissionHelper;
@@ -78,8 +76,10 @@ import org.schabi.newpipe.util.ThemeHelper;
import java.util.ArrayList;
import java.util.List;
+import java.util.Locale;
import static org.schabi.newpipe.util.Localization.changeAppLanguage;
+import static org.schabi.newpipe.util.Localization.getAppLanguage;
public class MainActivity extends AppCompatActivity {
private static final String TAG = "MainActivity";
@@ -116,10 +116,9 @@ public class MainActivity extends AppCompatActivity {
if (Build.VERSION.SDK_INT == Build.VERSION_CODES.KITKAT) {
TLSSocketFactoryCompat.setAsDefault();
}
-
ThemeHelper.setTheme(this, ServiceHelper.getSelectedServiceId(this));
- changeAppLanguage(Localization.getPreferredLocale(getApplicationContext()), getResources());
+ changeAppLanguage(getAppLanguage(getApplicationContext()), getResources());
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
@@ -424,6 +423,7 @@ public class MainActivity extends AppCompatActivity {
@Override
protected void onResume() {
+ changeAppLanguage(getAppLanguage(getApplicationContext()), getResources());
super.onResume();
// close drawer on return, and don't show animation, so its looks like the drawer isn't open
diff --git a/app/src/main/java/org/schabi/newpipe/about/AboutActivity.java b/app/src/main/java/org/schabi/newpipe/about/AboutActivity.java
index 2326e795e..4da1611d3 100644
--- a/app/src/main/java/org/schabi/newpipe/about/AboutActivity.java
+++ b/app/src/main/java/org/schabi/newpipe/about/AboutActivity.java
@@ -25,6 +25,11 @@ import org.schabi.newpipe.R;
import org.schabi.newpipe.util.NavigationHelper;
import org.schabi.newpipe.util.ThemeHelper;
+import java.util.Locale;
+
+import static org.schabi.newpipe.util.Localization.changeAppLanguage;
+import static org.schabi.newpipe.util.Localization.getAppLanguage;
+
public class AboutActivity extends AppCompatActivity {
/**
@@ -62,6 +67,7 @@ public class AboutActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
+ changeAppLanguage(getAppLanguage(getApplicationContext()), getResources());
super.onCreate(savedInstanceState);
ThemeHelper.setTheme(this);
diff --git a/app/src/main/java/org/schabi/newpipe/download/DownloadActivity.java b/app/src/main/java/org/schabi/newpipe/download/DownloadActivity.java
index 449a790e8..b8bfcf480 100644
--- a/app/src/main/java/org/schabi/newpipe/download/DownloadActivity.java
+++ b/app/src/main/java/org/schabi/newpipe/download/DownloadActivity.java
@@ -15,9 +15,14 @@ import org.schabi.newpipe.R;
import org.schabi.newpipe.settings.SettingsActivity;
import org.schabi.newpipe.util.ThemeHelper;
+import java.util.Locale;
+
import us.shandian.giga.service.DownloadManagerService;
import us.shandian.giga.ui.fragment.MissionsFragment;
+import static org.schabi.newpipe.util.Localization.changeAppLanguage;
+import static org.schabi.newpipe.util.Localization.getAppLanguage;
+
public class DownloadActivity extends AppCompatActivity {
private static final String MISSIONS_FRAGMENT_TAG = "fragment_tag";
@@ -29,6 +34,7 @@ public class DownloadActivity extends AppCompatActivity {
i.setClass(this, DownloadManagerService.class);
startService(i);
+ changeAppLanguage(getAppLanguage(getApplicationContext()), getResources());
ThemeHelper.setTheme(this);
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_downloader);
diff --git a/app/src/main/java/org/schabi/newpipe/settings/ContentSettingsFragment.java b/app/src/main/java/org/schabi/newpipe/settings/ContentSettingsFragment.java
index 0c7a4b46e..88c700582 100644
--- a/app/src/main/java/org/schabi/newpipe/settings/ContentSettingsFragment.java
+++ b/app/src/main/java/org/schabi/newpipe/settings/ContentSettingsFragment.java
@@ -56,6 +56,7 @@ public class ContentSettingsFragment extends BasePreferenceFragment {
private Localization initialSelectedLocalization;
private ContentCountry initialSelectedContentCountry;
+ private String initialLanguage;
@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
@@ -64,6 +65,7 @@ public class ContentSettingsFragment extends BasePreferenceFragment {
initialSelectedLocalization = org.schabi.newpipe.util.Localization.getPreferredLocalization(requireContext());
initialSelectedContentCountry = org.schabi.newpipe.util.Localization.getPreferredContentCountry(requireContext());
+ initialLanguage = androidx.preference.PreferenceManager.getDefaultSharedPreferences(getContext()).getString("newpipes_language_key", "en");
}
@Override
@@ -125,9 +127,10 @@ public class ContentSettingsFragment extends BasePreferenceFragment {
.getPreferredLocalization(requireContext());
final ContentCountry selectedContentCountry = org.schabi.newpipe.util.Localization
.getPreferredContentCountry(requireContext());
+ final String selectedLanguage = androidx.preference.PreferenceManager.getDefaultSharedPreferences(getContext()).getString("newpipes_language_key", "en");
if (!selectedLocalization.equals(initialSelectedLocalization)
- || !selectedContentCountry.equals(initialSelectedContentCountry)) {
+ || !selectedContentCountry.equals(initialSelectedContentCountry) || !selectedLanguage.equals(initialLanguage)) {
Toast.makeText(requireContext(), R.string.localization_changes_requires_app_restart, Toast.LENGTH_LONG).show();
NewPipe.setupLocalization(selectedLocalization, selectedContentCountry);
diff --git a/app/src/main/java/org/schabi/newpipe/settings/SettingsActivity.java b/app/src/main/java/org/schabi/newpipe/settings/SettingsActivity.java
index a3f218074..40af9f460 100644
--- a/app/src/main/java/org/schabi/newpipe/settings/SettingsActivity.java
+++ b/app/src/main/java/org/schabi/newpipe/settings/SettingsActivity.java
@@ -14,6 +14,11 @@ import android.view.MenuItem;
import org.schabi.newpipe.R;
import org.schabi.newpipe.util.ThemeHelper;
+import java.util.Locale;
+
+import static org.schabi.newpipe.util.Localization.changeAppLanguage;
+import static org.schabi.newpipe.util.Localization.getAppLanguage;
+
/*
* Created by Christian Schabesberger on 31.08.15.
@@ -44,7 +49,7 @@ public class SettingsActivity extends AppCompatActivity implements BasePreferenc
@Override
protected void onCreate(Bundle savedInstanceBundle) {
setTheme(ThemeHelper.getSettingsThemeStyle(this));
-
+ changeAppLanguage(getAppLanguage(getApplicationContext()), getResources());
super.onCreate(savedInstanceBundle);
setContentView(R.layout.settings_layout);
diff --git a/app/src/main/java/org/schabi/newpipe/util/Localization.java b/app/src/main/java/org/schabi/newpipe/util/Localization.java
index 6b0b4cd0c..7d742b04a 100644
--- a/app/src/main/java/org/schabi/newpipe/util/Localization.java
+++ b/app/src/main/java/org/schabi/newpipe/util/Localization.java
@@ -7,6 +7,11 @@ import android.content.res.Resources;
import android.preference.PreferenceManager;
import android.text.TextUtils;
import android.util.DisplayMetrics;
+import android.widget.Toast;
+
+import androidx.annotation.NonNull;
+import androidx.annotation.PluralsRes;
+import androidx.annotation.StringRes;
import org.ocpsoft.prettytime.PrettyTime;
import org.ocpsoft.prettytime.units.Decade;
@@ -21,10 +26,6 @@ import java.util.Date;
import java.util.List;
import java.util.Locale;
-import androidx.annotation.NonNull;
-import androidx.annotation.PluralsRes;
-import androidx.annotation.StringRes;
-
/*
* Created by chschtsch on 12/29/15.
*
@@ -226,4 +227,21 @@ public class Localization {
conf.setLocale(loc);
res.updateConfiguration(conf, dm);
}
+
+ public static Locale getAppLanguage(Context context) {
+ SharedPreferences prefs = androidx.preference.PreferenceManager.getDefaultSharedPreferences(context);
+ String lang = prefs.getString("newpipes_language_key", "en");
+ Locale loc;
+ if (lang.equals("system")) {
+ loc = Locale.getDefault();
+ } else if (lang.matches(".*-.*")) {
+ String[] localisation = lang.split("-");
+ lang = localisation[0];
+ String country = localisation[1];
+ loc = new Locale(lang, country);
+ } else {
+ loc = new Locale(lang);
+ }
+ return loc;
+ }
}
diff --git a/app/src/main/res/values-ur/strings.xml b/app/src/main/res/values-ur/strings.xml
index 089b793c8..ce6f3f651 100644
--- a/app/src/main/res/values-ur/strings.xml
+++ b/app/src/main/res/values-ur/strings.xml
@@ -193,13 +193,13 @@
بی
کوئی صارفین نہیں
- - % s صارف
- - % s صارفین
+ - %s صارف
+ - %s صارفین
کوئی مناظر نہیں
- - % s منظر
- - % s مناظر
+ - %s منظر
+ - %s مناظر
ویڈیوز دستیاب نہیں
@@ -388,7 +388,7 @@
کوئی حد نہیں
موبائل ڈیٹا کا استعمال کرتے وقت ریذولوشن کو محدود کریں
ایپ سوئچ کو کم سے کم کریں
- اہم ویڈیو پلیئر سے دوسرے ایپ میں سوئچنگ کرتے وقت کارروائی-% s
+ اہم ویڈیو پلیئر سے دوسرے ایپ میں سوئچنگ کرتے وقت کارروائی-s%
کوئی نہیں
پس منظری پلیر میں کم کریں
پاپ اپ پلیر میں کم کریں
diff --git a/app/src/main/res/values/settings_keys.xml b/app/src/main/res/values/settings_keys.xml
index 3f361226d..299803a43 100644
--- a/app/src/main/res/values/settings_keys.xml
+++ b/app/src/main/res/values/settings_keys.xml
@@ -31,20 +31,20 @@
seek_duration
10000
- - 5 seconds
- - 10 seconds
- - 15 seconds
- - 20 seconds
- - 25 seconds
- - 30 seconds
+ - 5 seconds
+ - 10 seconds
+ - 15 seconds
+ - 20 seconds
+ - 25 seconds
+ - 30 seconds
- - 5000
- - 10000
- - 15000
- - 20000
- - 25000
- - 30000
+ - 5000
+ - 10000
+ - 15000
+ - 20000
+ - 25000
+ - 30000
minimize_on_exit_key
@@ -175,6 +175,7 @@
main_page_content
enable_playback_resume
enable_playback_state_lists
+ newpipes_language_key
import_data
export_data
@@ -272,7 +273,6 @@
- cs
- da
- de
- - eo
- et
- en-GB
- en
@@ -352,7 +352,6 @@
- Čeština
- Dansk
- Deutsch
- - Esperanto
- Eesti
- English (UK)
- English (US)
@@ -925,6 +924,137 @@
- ZW
+
+
+ - system
+ - ar
+ - az
+ - ast
+ - be
+ - bg-bd
+ - bn
+ - ca
+ - cs
+ - da
+ - de
+ - el
+ - en
+ - eo
+ - es
+ - et
+ - eu
+ - fa
+ - fi
+ - fil
+ - fr
+ - gl
+ - he
+ - hi
+ - hr
+ - hu
+ - hy
+ - ia
+ - ind
+ - it
+ - ja
+ - ko
+ - ku
+ - lt
+ - mk
+ - ms
+ - nb-no
+ - ne
+ - nl
+ - nl-be
+ - pa
+ - pl
+ - pr
+ - pt
+ - pt-br
+ - ro
+ - ru
+ - sk
+ - sl
+ - sq
+ - sr
+ - sv
+ - ta
+ - te
+ - th
+ - tr
+ - uk
+ - ur
+ - vi
+ - zh
+ - zh-hans
+ - zh-tw
+
+
+ - @string/system
+ - العربية
+ - Azərbaycan dili
+ - Asturianu
+ - Беларуская
+ - български език
+ - বাংলা
+ - Català
+ - Čeština
+ - Dansk
+ - Deutsch
+ - Ελληνικά
+ - English
+ - Esperanto
+ - Español
+ - Eesti keel
+ - Euskara
+ - فارسی
+ - Suomen kieli
+ - Wikang Filipino
+ - Français
+ - Galego
+ - עברית
+ - हिन्दी
+ - Hrvatski
+ - magyar
+ - Հայերեն
+ - Interlingua
+ - Bahasa Indonesia
+ - Italiano
+ - 日本語
+ - 한국어
+ - کوردی
+ - Lietuvių kalba
+ - македонски јазик
+ - Bahasa Melayu
+ - Norsk bokmål
+ - Nनेपाली
+ - Nederlands (NL)
+ - Nederlands (BE)
+ - ਪੰਜਾਬੀ
+ - Polski
+ - Pirate Language
+ - Português (PT)
+ - Português (BR)
+ - Română
+ - русский язык
+ - Slovenčina
+ - Slovenščina
+ - Shqip
+ - Српски
+ - Svenska
+ - தமிழ்
+ - తెలుగు
+ - ไทย
+ - Türkçe
+ - українська мова
+ - اردو
+ - Tiếng Việt
+ - 官话
+ - 简化字
+ - 臺灣華語
+
+
+
limit_mobile_data_usage
limit_data_usage_none
@@ -943,6 +1073,7 @@
list_view_mode
auto
+ System
- auto
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 6021df15e..12a96fe74 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -585,5 +585,6 @@
Use SAF
The Storage Access Framework allows downloads to an external SD card.\nNote: some devices are not compatible
Choose an instance
+ NewPipe\'s language
diff --git a/app/src/main/res/xml/content_settings.xml b/app/src/main/res/xml/content_settings.xml
index 4044e92d8..ab9896cde 100644
--- a/app/src/main/res/xml/content_settings.xml
+++ b/app/src/main/res/xml/content_settings.xml
@@ -3,6 +3,16 @@
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:title="@string/content">
+
+
+