Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(YouTube - Keyword filter): Add syntax to match whole keywords and not substrings #3592

Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,10 @@ object HideLayoutComponentsPatch : BytecodePatch(
SwitchPreference("revanced_hide_keyword_content_search"),
TextPreference("revanced_hide_keyword_content_phrases", inputType = InputType.TEXT_MULTI_LINE),
NonInteractivePreference("revanced_hide_keyword_content_about"),
),
),
NonInteractivePreference(key = "revanced_hide_keyword_content_about_whole_words",
tag = "app.revanced.integrations.youtube.settings.preference.HtmlPreference")
)
)
)

SettingsPatch.PreferenceScreen.GENERAL_LAYOUT.addPreferences(
Expand Down
15 changes: 9 additions & 6 deletions src/main/resources/addresources/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -244,14 +244,17 @@ This is because Crowdin requires temporarily flattening this file and removing t
<string name="revanced_hide_keyword_content_phrases_title">Keywords to hide</string>
<!-- For localization it is preferred, but not required, if 'LeBlanc' is replaced with a localized name or a familiar word that has upper case letters in the middle of the word.
This is because keywords can be in any language, and showing an example in the localized script helps convey this. -->
<string name="revanced_hide_keyword_content_phrases_summary">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>
<string name="revanced_hide_keyword_content_phrases_summary">Keywords and phrases to hide, separated by new lines\n\nKeywords can be channel names or any text shown in video titles\n\nWords with uppercase letters in the middle must be entered with the casing (ie: iPhone, TikTok, LeBlanc)</string>
<string name="revanced_hide_keyword_content_about_title">About keyword filtering</string>
<string name="revanced_hide_keyword_content_about_summary">Home/Subscription/Search results are filtered to hide content that matches keyword phrases\n\nLimitations\n• Some Shorts may not be hidden\n• Some UI components may not be hidden\n• Searching for a keyword may show no results</string>
<string name="revanced_hide_keyword_content_about_summary">Home/Subscription/Search results are filtered to hide content that matches keyword phrases\n\nLimitations\n• Shorts cannot be hidden by channel name\n• Some UI components may not be hidden\n• Searching for a keyword may show no results</string>
<string name="revanced_hide_keyword_content_about_whole_words_title">Match whole words</string>
<string name="revanced_hide_keyword_content_about_whole_words_summary">Surround a keyword/phrase with quotes, and video titles with partial matches will not be hidden&lt;br>&lt;br>For example,&lt;br>&lt;b>\"ai\"&lt;/b> will hide the video: &lt;b>Is AI dumb?&lt;/b>&lt;br>but will not hide: &lt;b>DMCA fair use explained!&lt;/b></string>
LisoUseInAIKyrios marked this conversation as resolved.
Show resolved Hide resolved
<!-- Translations of this should not be longer than the original English text, otherwise the text can be clipped and not entirely shown. -->
<string name="revanced_hide_keyword_toast_invalid_common">Invalid keyword. Cannot use: \'%s\' as a filter</string>
<!-- Translations of this should not be longer than the original English text, otherwise the text can be clipped and not entirely shown. -->
<string name="revanced_hide_keyword_toast_invalid_length">Invalid keyword. \'%1$s\' is less than %2$d characters</string>
<string name="revanced_hide_keyword_toast_invalid_broad">Keyword \'%s\' will hide all videos</string>
<string name="revanced_hide_keyword_toast_invalid_common">Cannot use keyword: \'%s\'</string>
<string name="revanced_hide_keyword_toast_invalid_common_whole_word_required">Add quotes to use keyword: \'%s\'</string>
<string name="revanced_hide_keyword_toast_invalid_conflicting">Keyword has conflicting declarations: \'%s\'</string>
<string name="revanced_hide_keyword_toast_invalid_length">\'%1$s\' is too short and requires quotes</string>
<string name="revanced_hide_keyword_toast_invalid_broad">Keyword will hide all videos: \'%s\'</string>
</patch>
<patch id="ad.general.HideAdsResourcePatch">
<string name="revanced_hide_general_ads_title">Hide general ads</string>
Expand Down
Loading