mirror of
https://github.com/TeamNewPipe/NewPipe
synced 2024-12-25 09:30:32 +00:00
Update localizations settings
1) now, on « content language » change, it will also change the app language 2) added Esperanto to the list of language in content language
This commit is contained in:
parent
c56fb8cec2
commit
dea1e0dcb9
@ -67,6 +67,7 @@ import org.schabi.newpipe.fragments.list.search.SearchFragment;
|
|||||||
import org.schabi.newpipe.report.ErrorActivity;
|
import org.schabi.newpipe.report.ErrorActivity;
|
||||||
import org.schabi.newpipe.util.Constants;
|
import org.schabi.newpipe.util.Constants;
|
||||||
import org.schabi.newpipe.util.KioskTranslator;
|
import org.schabi.newpipe.util.KioskTranslator;
|
||||||
|
import org.schabi.newpipe.util.Localization;
|
||||||
import org.schabi.newpipe.util.NavigationHelper;
|
import org.schabi.newpipe.util.NavigationHelper;
|
||||||
import org.schabi.newpipe.util.PeertubeHelper;
|
import org.schabi.newpipe.util.PeertubeHelper;
|
||||||
import org.schabi.newpipe.util.PermissionHelper;
|
import org.schabi.newpipe.util.PermissionHelper;
|
||||||
@ -78,6 +79,8 @@ import org.schabi.newpipe.util.ThemeHelper;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import static org.schabi.newpipe.util.Localization.changeAppLanguage;
|
||||||
|
|
||||||
public class MainActivity extends AppCompatActivity {
|
public class MainActivity extends AppCompatActivity {
|
||||||
private static final String TAG = "MainActivity";
|
private static final String TAG = "MainActivity";
|
||||||
public static final boolean DEBUG = !BuildConfig.BUILD_TYPE.equals("release");
|
public static final boolean DEBUG = !BuildConfig.BUILD_TYPE.equals("release");
|
||||||
@ -116,6 +119,8 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
|
|
||||||
ThemeHelper.setTheme(this, ServiceHelper.getSelectedServiceId(this));
|
ThemeHelper.setTheme(this, ServiceHelper.getSelectedServiceId(this));
|
||||||
|
|
||||||
|
changeAppLanguage(Localization.getPreferredLocale(getApplicationContext()), getResources());
|
||||||
|
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
setContentView(R.layout.activity_main);
|
setContentView(R.layout.activity_main);
|
||||||
|
|
||||||
|
@ -2,8 +2,11 @@ package org.schabi.newpipe.util;
|
|||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
|
import android.content.res.Configuration;
|
||||||
|
import android.content.res.Resources;
|
||||||
import android.preference.PreferenceManager;
|
import android.preference.PreferenceManager;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
|
import android.util.DisplayMetrics;
|
||||||
|
|
||||||
import org.ocpsoft.prettytime.PrettyTime;
|
import org.ocpsoft.prettytime.PrettyTime;
|
||||||
import org.ocpsoft.prettytime.units.Decade;
|
import org.ocpsoft.prettytime.units.Decade;
|
||||||
@ -216,4 +219,11 @@ public class Localization {
|
|||||||
public static String relativeTime(Calendar calendarTime) {
|
public static String relativeTime(Calendar calendarTime) {
|
||||||
return getPrettyTime().formatUnrounded(calendarTime);
|
return getPrettyTime().formatUnrounded(calendarTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void changeAppLanguage(Locale loc, Resources res) {
|
||||||
|
DisplayMetrics dm = res.getDisplayMetrics();
|
||||||
|
Configuration conf = res.getConfiguration();
|
||||||
|
conf.setLocale(loc);
|
||||||
|
res.updateConfiguration(conf, dm);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -272,6 +272,7 @@
|
|||||||
<item>cs</item>
|
<item>cs</item>
|
||||||
<item>da</item>
|
<item>da</item>
|
||||||
<item>de</item>
|
<item>de</item>
|
||||||
|
<item>eo</item>
|
||||||
<item>et</item>
|
<item>et</item>
|
||||||
<item>en-GB</item>
|
<item>en-GB</item>
|
||||||
<item>en</item>
|
<item>en</item>
|
||||||
@ -351,6 +352,7 @@
|
|||||||
<item>Čeština</item>
|
<item>Čeština</item>
|
||||||
<item>Dansk</item>
|
<item>Dansk</item>
|
||||||
<item>Deutsch</item>
|
<item>Deutsch</item>
|
||||||
|
<item>Esperanto</item>
|
||||||
<item>Eesti</item>
|
<item>Eesti</item>
|
||||||
<item>English (UK)</item>
|
<item>English (UK)</item>
|
||||||
<item>English (US)</item>
|
<item>English (US)</item>
|
||||||
|
Loading…
Reference in New Issue
Block a user