Skip to content

Commit c30c031

Browse files
committed
fix(YouTube - Translations): Update translations info
1 parent 1c3731d commit c30c031

24 files changed

+639
-518
lines changed

search_for_missing_strings.py

+77
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
import os
2+
import re
3+
4+
# Define source file path
5+
source_file = "src/main/resources/youtube/settings/host/values/strings.xml"
6+
7+
# Define destination directory path
8+
destination_directory = "src/main/resources/youtube/translations"
9+
10+
# Function to extract strings from a file
11+
def extract_strings(file_path):
12+
with open(file_path, 'r') as file:
13+
content = file.read()
14+
strings = re.findall(r'<string(?:\s+name="([^"]*)")?(.*?)>(.*?)</string>', content, re.DOTALL)
15+
return set(strings)
16+
17+
# Extract strings from source file
18+
source_strings = extract_strings(source_file)
19+
20+
# Loop through destination folders
21+
# If you want to search only one language folder add +"/your_lang" to destination_directory
22+
# like this => for root, dirs, files in os.walk(destination_directory+"/ar"):
23+
for root, dirs, files in os.walk(destination_directory):
24+
if "strings.xml" in files:
25+
# Get destination file path
26+
destination_file = os.path.join(root, "strings.xml")
27+
28+
# Get destination folder name (language code)
29+
destination_folder = os.path.dirname(destination_file)
30+
language_code = os.path.basename(destination_folder)
31+
32+
# Output file path
33+
output_file = os.path.join(destination_folder, "missing_strings.xml")
34+
35+
# Check if source and destination files exist
36+
if not os.path.isfile(source_file):
37+
print(f"Error: {source_file} not found.")
38+
exit(1)
39+
40+
if not os.path.isfile(destination_file):
41+
print(f"Error: {destination_file} not found.")
42+
exit(1)
43+
44+
# Extract strings from destination file
45+
destination_strings = extract_strings(destination_file)
46+
47+
# Find missing strings
48+
missing_strings = []
49+
50+
for name, attributes, content in source_strings:
51+
if name not in {name for name, _, _ in destination_strings}:
52+
string_tag = f'<string'
53+
if name:
54+
string_tag += f' name="{name}"'
55+
if attributes:
56+
string_tag += f' {attributes.strip()}'
57+
string_tag += f'>{content}</string>\n'
58+
missing_strings.append(string_tag)
59+
60+
# Sort missing strings by name attribute
61+
missing_strings.sort(key=lambda x: re.search(r'name="([^"]*)"', x).group(1))
62+
63+
# Check if missing strings exist
64+
if not missing_strings:
65+
# Delete output file if exists
66+
if os.path.isfile(output_file):
67+
os.remove(output_file)
68+
69+
print(f"No missing strings for {language_code}")
70+
else:
71+
# Save missing strings to output file
72+
with open(output_file, 'w') as file:
73+
for string_tag in missing_strings:
74+
file.write(string_tag)
75+
76+
num_missing = len(missing_strings)
77+
print(f"{language_code} - {num_missing} missing strings.")

search_for_missing_strings.sh

-66
This file was deleted.

src/main/resources/youtube/translations/ar/missing_strings.xml

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@
55
<string name="revanced_spoof_failure_connection_status_code" formatted="false">"Spoof storyboard not available: "</string>
66
<string name="revanced_spoof_failure_connection_timeout">Spoof storyboard temporarily not available (API timed out).</string>
77
<string name="revanced_spoof_failure_generic">"Spoof storyboard temporarily not available: "</string>
8-
<string name="revanced_swipe_overlay_rect_warning" formatted="false">Swiapeable area size can't be more than %s%%. Reset to default value.</string>
98
<string name="revanced_swipe_overlay_rect_summary">Percentage of swipeable screen area.</string>
10-
<string name="revanced_swipe_overlay_rect_title">Swipe overlay screen size</string>
9+
<string name="revanced_swipe_overlay_rect_title">Swipe overlay screen size</string>
10+
<string name="revanced_swipe_overlay_rect_warning" formatted="false">Swipeable area size can\'t be more than %s%%. Reset to default value.</string>

src/main/resources/youtube/translations/bg-rBG/missing_strings.xml

+20-21
Original file line numberDiff line numberDiff line change
@@ -5,53 +5,52 @@
55
<string name="revanced_change_start_page_entry_music">Music</string>
66
<string name="revanced_change_start_page_entry_sports">Sports</string>
77
<string name="revanced_change_start_page_entry_watch_later">Watch later</string>
8-
<string name="revanced_keyword_invalid_length" formatted="false">Invalid keyword length (must be at least %s characters): %s.</string>
9-
<string name="revanced_keyword_filter_strings_summary">Configure keywords and phrases to hide, separated by new lines
10-
11-
Words with uppercase letters in the middle must be entered with the casing (ie: iPhone, TikTok, LeBlanc).</string>
12-
<string name="revanced_keyword_filter_strings_title">Edit keyword filter</string>
13-
<string name="revanced_keyword_filter_summary_off">Keyword filter is disabled.</string>
14-
<string name="revanced_keyword_filter_summary_on">Keyword filter is enabled.</string>
15-
<string name="revanced_keyword_filter_summary">Hides feed and search result videos using keyword filters.</string>
16-
<string name="revanced_keyword_filter_title">Enable keyword filter</string>
178
<string name="revanced_disable_rolling_number_animations_summary_off">Rolling animations are enabled.</string>
189
<string name="revanced_disable_rolling_number_animations_summary_on">Rolling animations are disabled.</string>
1910
<string name="revanced_disable_rolling_number_animations_title">Disable rolling number animations</string>
2011
<string name="revanced_hide_community_posts_related_video_summary_off">Community posts in related video are shown.</string>
2112
<string name="revanced_hide_community_posts_related_video_summary_on">Community posts in related video are hidden.</string>
2213
<string name="revanced_hide_community_posts_related_video_title">Hide community posts in related video</string>
14+
<string name="revanced_hide_home_feed_membership_video_summary">Hide videos with \"Only for Membership\" tag in Home Feed</string>
15+
<string name="revanced_hide_home_feed_membership_video_title">Hide membership videos in Home Feed</string>
2316
<string name="revanced_hide_suggested_video_overlay_auto_play_summary">When you finished a video, another play automatically</string>
2417
<string name="revanced_hide_suggested_video_overlay_auto_play_title">Auto play the next video</string>
25-
<string name="revanced_hide_home_feed_membership_video_summary">Hide videos with "Only for Membership" tag in Home Feed</string>
26-
<string name="revanced_hide_home_feed_membership_video_title">Hide membership videos in Home Feed</string>
18+
<string name="revanced_keyword_filter_strings_summary">Configure keywords and phrases to hide, separated by new lines\n\nWords with uppercase letters in the middle must be entered with the casing (ie: iPhone, TikTok, LeBlanc).</string>
19+
<string name="revanced_keyword_filter_strings_title">Edit keyword filter</string>
20+
<string name="revanced_keyword_filter_summary">Hides feed and search result videos using keyword filters.</string>
21+
<string name="revanced_keyword_filter_summary_off">Keyword filter is disabled.</string>
22+
<string name="revanced_keyword_filter_summary_on">Keyword filter is enabled.</string>
23+
<string name="revanced_keyword_filter_title">Enable keyword filter</string>
24+
<string name="revanced_keyword_invalid_length" formatted="false">Invalid keyword length (must be at least %s characters): %s.</string>
2725
<string name="revanced_overlay_button_time_ordered_playlist_summary">"Tap to generate a playlist of all videos from channel from oldest to newest.
26+
Tap and hold to undo."</string>
2827
<string name="revanced_overlay_button_time_ordered_playlist_title">Time-ordered playlist button</string>
2928
<string name="revanced_overlay_button_whitelisting_summary">Tap to launch add channel into Channel Whitelist.</string>
3029
<string name="revanced_overlay_button_whitelisting_title">Whitelist button</string>
3130
<string name="revanced_override_premium_header_summary_off">Current Header: Default Header</string>
3231
<string name="revanced_override_premium_header_summary_on">Current Header: Premium Header</string>
3332
<string name="revanced_override_premium_header_title">Premium Header</string>
34-
<string name="revanced_whitelisting_added" formatted="false">Channel %s was added to the %s whitelist</string>
33+
<string name="revanced_spoof_app_version_target_entry_16_08_35">16.08.35 - Restore old explore tab</string>
34+
<string name="revanced_spoof_app_version_target_entry_18_09_39">18.09.39 - Restore old library tab (Disable You Tab)</string>
35+
<string name="revanced_spoof_failure_connection_status_code" formatted="false">"Spoof storyboard not available: "</string>
36+
<string name="revanced_spoof_failure_connection_timeout">Spoof storyboard temporarily not available (API timed out).</string>
37+
<string name="revanced_spoof_failure_generic">"Spoof storyboard temporarily not available: "</string>
38+
<string name="revanced_swipe_overlay_rect_summary">Percentage of swipeable screen area.</string>
39+
<string name="revanced_swipe_overlay_rect_title">Swipe overlay screen size</string>
40+
<string name="revanced_swipe_overlay_rect_warning" formatted="false">Swipeable area size can\'t be more than %s%%. Reset to default value.</string>
3541
<string name="revanced_whitelisting_add_failed" formatted="false">Failed to add channel %s to the %s whitelist</string>
42+
<string name="revanced_whitelisting_added" formatted="false">Channel %s was added to the %s whitelist</string>
3643
<string name="revanced_whitelisting_channel_name">Channel Name</string>
3744
<string name="revanced_whitelisting_empty">There are no whitelisted channels</string>
3845
<string name="revanced_whitelisting_excluded">Not added to whitelist</string>
3946
<string name="revanced_whitelisting_fetch_failed" formated="false">Failed to retrieve channel details, received message %d</string>
4047
<string name="revanced_whitelisting_included">Added to whitelist</string>
4148
<string name="revanced_whitelisting_reboot">Reboot to apply channel whitelist settings</string>
42-
<string name="revanced_whitelisting_removed" formatted="false">Channel %s was removed from the %s whitelist</string>
4349
<string name="revanced_whitelisting_remove_failed" formatted="false">Failed to remove channel %s from the %s whitelist</string>
50+
<string name="revanced_whitelisting_removed" formatted="false">Channel %s was removed from the %s whitelist</string>
4451
<string name="revanced_whitelisting_settings_summary">Check or remove the list of channels added to the whitelist</string>
4552
<string name="revanced_whitelisting_speed">Video Speed</string>
4653
<string name="revanced_whitelisting_speed_button">Speed</string>
4754
<string name="revanced_whitelisting_sponsorblock">SponsorBlock</string>
4855
<string name="revanced_whitelisting_sponsorblock_button">SB</string>
4956
<string name="revanced_whitelisting_title">Channel Whitelist</string>
50-
<string name="revanced_spoof_app_version_target_entry_16_08_35">16.08.35 - Restore old explore tab</string>
51-
<string name="revanced_spoof_app_version_target_entry_18_09_39">18.09.39 - Restore old library tab (Disable You Tab)</string>
52-
<string name="revanced_spoof_failure_connection_status_code" formatted="false">"Spoof storyboard not available: "</string>
53-
<string name="revanced_spoof_failure_connection_timeout">Spoof storyboard temporarily not available (API timed out).</string>
54-
<string name="revanced_spoof_failure_generic">"Spoof storyboard temporarily not available: "</string>
55-
<string name="revanced_swipe_overlay_rect_warning" formatted="false">Swiapeable area size can't be more than %s%%. Reset to default value.</string>
56-
<string name="revanced_swipe_overlay_rect_summary">Percentage of swipeable screen area.</string>
57-
<string name="revanced_swipe_overlay_rect_title">Swipe overlay screen size</string>

0 commit comments

Comments
 (0)