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
3 changed files with 17 additions and 0 deletions
|
|
@ -2,8 +2,11 @@ package org.schabi.newpipe.util;
|
|||
|
||||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
import android.content.res.Configuration;
|
||||
import android.content.res.Resources;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.text.TextUtils;
|
||||
import android.util.DisplayMetrics;
|
||||
|
||||
import org.ocpsoft.prettytime.PrettyTime;
|
||||
import org.ocpsoft.prettytime.units.Decade;
|
||||
|
|
@ -216,4 +219,11 @@ public class Localization {
|
|||
public static String relativeTime(Calendar 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);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue