mirror of
https://github.com/TeamNewPipe/NewPipe
synced 2024-12-24 00:50:32 +00:00
created default_localization_key
This commit is contained in:
parent
5b541cc9fb
commit
e62e34fd5c
@ -63,7 +63,7 @@ dependencies {
|
|||||||
exclude module: 'support-annotations'
|
exclude module: 'support-annotations'
|
||||||
})
|
})
|
||||||
|
|
||||||
implementation 'com.github.B0pol:NewPipeExtractor:a9c6beec1434f4edd4197fb655e5327bae94cc92'
|
implementation 'com.github.TeamNewPipe:NewPipeExtractor:fc9f031'
|
||||||
testImplementation 'junit:junit:4.12'
|
testImplementation 'junit:junit:4.12'
|
||||||
testImplementation 'org.mockito:mockito-core:2.23.0'
|
testImplementation 'org.mockito:mockito-core:2.23.0'
|
||||||
|
|
||||||
|
@ -190,7 +190,7 @@ public class SearchFragment
|
|||||||
|
|
||||||
SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(activity);
|
SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(activity);
|
||||||
isSuggestionsEnabled = preferences.getBoolean(getString(R.string.show_search_suggestions_key), true);
|
isSuggestionsEnabled = preferences.getBoolean(getString(R.string.show_search_suggestions_key), true);
|
||||||
contentCountry = preferences.getString(getString(R.string.content_country_key), getString(R.string.default_country_value));
|
contentCountry = preferences.getString(getString(R.string.content_country_key), getString(R.string.default_localization_key));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -21,6 +21,7 @@ public class VideoAudioSettingsFragment extends BasePreferenceFragment {
|
|||||||
public void onCreate(@Nullable Bundle savedInstanceState) {
|
public void onCreate(@Nullable Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
|
||||||
|
//initializing R.array.seek_duration_description to display the translation of seconds
|
||||||
String[] durationsDescriptions = getResources().getStringArray(R.array.seek_duration_description);
|
String[] durationsDescriptions = getResources().getStringArray(R.array.seek_duration_description);
|
||||||
String[] durationsValues = getResources().getStringArray(R.array.seek_duration_value);
|
String[] durationsValues = getResources().getStringArray(R.array.seek_duration_value);
|
||||||
int currentDurationValue;
|
int currentDurationValue;
|
||||||
|
@ -83,8 +83,8 @@ public class Localization {
|
|||||||
public static org.schabi.newpipe.extractor.localization.Localization getPreferredLocalization(final Context context) {
|
public static org.schabi.newpipe.extractor.localization.Localization getPreferredLocalization(final Context context) {
|
||||||
final String contentLanguage = PreferenceManager
|
final String contentLanguage = PreferenceManager
|
||||||
.getDefaultSharedPreferences(context)
|
.getDefaultSharedPreferences(context)
|
||||||
.getString(context.getString(R.string.content_language_key), context.getString(R.string.default_language_value));
|
.getString(context.getString(R.string.content_language_key), context.getString(R.string.default_localization_key));
|
||||||
if (contentLanguage.equals("system")) {
|
if (contentLanguage.equals(context.getString(R.string.default_localization_key))) {
|
||||||
return org.schabi.newpipe.extractor.localization.Localization.fromLocale(Locale.getDefault());
|
return org.schabi.newpipe.extractor.localization.Localization.fromLocale(Locale.getDefault());
|
||||||
}
|
}
|
||||||
return org.schabi.newpipe.extractor.localization.Localization.fromLocalizationCode(contentLanguage);
|
return org.schabi.newpipe.extractor.localization.Localization.fromLocalizationCode(contentLanguage);
|
||||||
@ -93,8 +93,8 @@ public class Localization {
|
|||||||
public static ContentCountry getPreferredContentCountry(final Context context) {
|
public static ContentCountry getPreferredContentCountry(final Context context) {
|
||||||
final String contentCountry = PreferenceManager
|
final String contentCountry = PreferenceManager
|
||||||
.getDefaultSharedPreferences(context)
|
.getDefaultSharedPreferences(context)
|
||||||
.getString(context.getString(R.string.content_country_key), context.getString(R.string.default_country_value));
|
.getString(context.getString(R.string.content_country_key), context.getString(R.string.default_localization_key));
|
||||||
if (contentCountry.equals("system")) {
|
if (contentCountry.equals(context.getString(R.string.default_localization_key))) {
|
||||||
return new ContentCountry(Locale.getDefault().getCountry());
|
return new ContentCountry(Locale.getDefault().getCountry());
|
||||||
}
|
}
|
||||||
return new ContentCountry(contentCountry);
|
return new ContentCountry(contentCountry);
|
||||||
@ -104,7 +104,7 @@ public class Localization {
|
|||||||
SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(context);
|
SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(context);
|
||||||
|
|
||||||
String languageCode = sp.getString(context.getString(R.string.content_language_key),
|
String languageCode = sp.getString(context.getString(R.string.content_language_key),
|
||||||
context.getString(R.string.default_language_value));
|
context.getString(R.string.default_localization_key));
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (languageCode.length() == 2) {
|
if (languageCode.length() == 2) {
|
||||||
@ -236,7 +236,7 @@ public class Localization {
|
|||||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
|
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
|
||||||
String lang = prefs.getString(context.getString(R.string.app_language_key), "en");
|
String lang = prefs.getString(context.getString(R.string.app_language_key), "en");
|
||||||
Locale loc;
|
Locale loc;
|
||||||
if (lang.equals("system")) {
|
if (lang.equals(context.getString(R.string.default_localization_key))) {
|
||||||
loc = Locale.getDefault();
|
loc = Locale.getDefault();
|
||||||
} else if (lang.matches(".*-.*")) {
|
} else if (lang.matches(".*-.*")) {
|
||||||
//to differentiate different versions of the language
|
//to differentiate different versions of the language
|
||||||
|
@ -161,8 +161,6 @@
|
|||||||
<string name="show_comments_key" translatable="false">show_comments</string>
|
<string name="show_comments_key" translatable="false">show_comments</string>
|
||||||
<string name="stream_info_selected_tab_key" translatable="false">stream_info_selected_tab</string>
|
<string name="stream_info_selected_tab_key" translatable="false">stream_info_selected_tab</string>
|
||||||
<string name="show_hold_to_append_key" translatable="false">show_hold_to_append</string>
|
<string name="show_hold_to_append_key" translatable="false">show_hold_to_append</string>
|
||||||
<string name="default_language_value" translatable="false">system</string>
|
|
||||||
<string name="default_country_value" translatable="false">system</string>
|
|
||||||
<string name="content_language_key" translatable="false">content_language</string>
|
<string name="content_language_key" translatable="false">content_language</string>
|
||||||
<string name="peertube_instance_setup_key" translatable="false">peertube_instance_setup</string>
|
<string name="peertube_instance_setup_key" translatable="false">peertube_instance_setup</string>
|
||||||
<string name="peertube_selected_instance_key" translatable="false">peertube_selected_instance</string>
|
<string name="peertube_selected_instance_key" translatable="false">peertube_selected_instance</string>
|
||||||
@ -265,9 +263,11 @@
|
|||||||
<string name="update_app_key" translatable="false">update_app_key</string>
|
<string name="update_app_key" translatable="false">update_app_key</string>
|
||||||
<string name="update_pref_screen_key" translatable="false">update_pref_screen_key</string>
|
<string name="update_pref_screen_key" translatable="false">update_pref_screen_key</string>
|
||||||
|
|
||||||
|
<!-- Localizations -->
|
||||||
|
<string name="default_localization_key" translatable="false">system</string>
|
||||||
<!-- alternatively, load these from some local android data store -->
|
<!-- alternatively, load these from some local android data store -->
|
||||||
<string-array name="language_codes" translatable="false">
|
<string-array name="language_codes" translatable="false">
|
||||||
<item>system</item>
|
<item>@string/default_localization_key</item>
|
||||||
<item>af</item>
|
<item>af</item>
|
||||||
<item>az</item>
|
<item>az</item>
|
||||||
<item>id</item>
|
<item>id</item>
|
||||||
@ -680,7 +680,7 @@
|
|||||||
</string-array>
|
</string-array>
|
||||||
|
|
||||||
<string-array name="country_codes" translatable="false">
|
<string-array name="country_codes" translatable="false">
|
||||||
<item>system</item>
|
<item>@string/default_localization_key</item>
|
||||||
<item>AF</item>
|
<item>AF</item>
|
||||||
<item>AX</item>
|
<item>AX</item>
|
||||||
<item>AL</item>
|
<item>AL</item>
|
||||||
@ -932,7 +932,7 @@
|
|||||||
|
|
||||||
<!--The next two arrays are set to change the app language-->
|
<!--The next two arrays are set to change the app language-->
|
||||||
<string-array name="app_language_code" translatable="false">
|
<string-array name="app_language_code" translatable="false">
|
||||||
<item>system</item>
|
<item>@string/default_localization_key</item>
|
||||||
<item>ar</item>
|
<item>ar</item>
|
||||||
<item>az</item>
|
<item>az</item>
|
||||||
<item>ast</item>
|
<item>ast</item>
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
<ListPreference
|
<ListPreference
|
||||||
app:iconSpaceReserved="false"
|
app:iconSpaceReserved="false"
|
||||||
android:defaultValue="system"
|
android:defaultValue="@string/default_localization_key"
|
||||||
android:entries="@array/app_language_name"
|
android:entries="@array/app_language_name"
|
||||||
android:entryValues="@array/app_language_code"
|
android:entryValues="@array/app_language_code"
|
||||||
android:key="@string/app_language_key"
|
android:key="@string/app_language_key"
|
||||||
@ -15,7 +15,7 @@
|
|||||||
|
|
||||||
<ListPreference
|
<ListPreference
|
||||||
app:iconSpaceReserved="false"
|
app:iconSpaceReserved="false"
|
||||||
android:defaultValue="@string/default_language_value"
|
android:defaultValue="@string/default_localization_key"
|
||||||
android:entries="@array/language_names"
|
android:entries="@array/language_names"
|
||||||
android:entryValues="@array/language_codes"
|
android:entryValues="@array/language_codes"
|
||||||
android:key="@string/content_language_key"
|
android:key="@string/content_language_key"
|
||||||
@ -24,7 +24,7 @@
|
|||||||
|
|
||||||
<ListPreference
|
<ListPreference
|
||||||
app:iconSpaceReserved="false"
|
app:iconSpaceReserved="false"
|
||||||
android:defaultValue="@string/default_country_value"
|
android:defaultValue="@string/default_localization_key"
|
||||||
android:entries="@array/country_names"
|
android:entries="@array/country_names"
|
||||||
android:entryValues="@array/country_codes"
|
android:entryValues="@array/country_codes"
|
||||||
android:key="@string/content_country_key"
|
android:key="@string/content_country_key"
|
||||||
|
Loading…
Reference in New Issue
Block a user