mirror of
https://codeberg.org/leana8959/.files.git
synced 2025-12-06 14:49:14 +00:00
vanadium: firefox search engine for each language
This commit is contained in:
parent
26d1f9cf1e
commit
2be0eb8cc6
1 changed files with 79 additions and 85 deletions
|
|
@ -9,12 +9,6 @@
|
||||||
# reference: https://developers.google.com/custom-search/docs/xml_results?hl=zh-tw#advanced-search-query-parameters
|
# reference: https://developers.google.com/custom-search/docs/xml_results?hl=zh-tw#advanced-search-query-parameters
|
||||||
mkLrFlag = languageRestrictions:
|
mkLrFlag = languageRestrictions:
|
||||||
"&lr=" + lib.escapeURL (builtins.concatStringsSep "|" languageRestrictions);
|
"&lr=" + lib.escapeURL (builtins.concatStringsSep "|" languageRestrictions);
|
||||||
|
|
||||||
mkGlFlag = preferredCountry:
|
|
||||||
"&gl=" + preferredCountry;
|
|
||||||
|
|
||||||
mkHlFlag = hostLanguage:
|
|
||||||
"&hl=" + hostLanguage;
|
|
||||||
in {
|
in {
|
||||||
programs.firefox = {
|
programs.firefox = {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
|
@ -23,30 +17,30 @@ in {
|
||||||
RequestedLocales = ["fr" "en-US" "zh-TW"];
|
RequestedLocales = ["fr" "en-US" "zh-TW"];
|
||||||
|
|
||||||
SearchEngines = {
|
SearchEngines = {
|
||||||
Default = "Google Customized";
|
Default = "Google EN";
|
||||||
Remove = ["Google"];
|
Remove = ["Google"];
|
||||||
Add = let
|
Add = let
|
||||||
withGoogleFlags = x:
|
langs = ["lang_fr" "lang_en" "lang_zh-TW"];
|
||||||
x
|
in
|
||||||
+ mkLrFlag ["lang_fr" "lang_en" "lang_zh-TW"]
|
# Google specialized for each language
|
||||||
+ mkGlFlag "fr"
|
map (lang: let
|
||||||
+ mkHlFlag "fr";
|
shortcode = lib.substring 0 2 (lib.removePrefix "lang_" lang);
|
||||||
in [
|
in {
|
||||||
# Google and its evil empire™
|
Name = "Google " + lib.toUpper shortcode;
|
||||||
{
|
Alias = "G" + shortcode;
|
||||||
Name = "Google Customized";
|
|
||||||
Alias = "G";
|
|
||||||
IconURL = "https://google.com/favicon.ico";
|
IconURL = "https://google.com/favicon.ico";
|
||||||
Description = "Your data yum yum";
|
Description = "Your data yum yum (but ${shortcode})";
|
||||||
SuggestURLTemplate = withGoogleFlags "https://suggestqueries.google.com/complete/search?q={searchTerms}";
|
SuggestURLTemplate = "https://suggestqueries.google.com/complete/search?q={searchTerms}" + mkLrFlag [lang];
|
||||||
URLTemplate = withGoogleFlags "https://google.com/search?q={searchTerms}";
|
URLTemplate = "https://google.com/search?q={searchTerms}" + mkLrFlag [lang];
|
||||||
}
|
})
|
||||||
|
langs
|
||||||
|
++ [
|
||||||
{
|
{
|
||||||
Name = "YouTube";
|
Name = "YouTube";
|
||||||
Alias = "yt";
|
Alias = "yt";
|
||||||
IconURL = "https://youtube.com/favicon.ico";
|
IconURL = "https://youtube.com/favicon.ico";
|
||||||
SuggestURLTemplate = withGoogleFlags "http://suggestqueries.google.com/complete/search?q={searchTerms}&ds=yt";
|
SuggestURLTemplate = "http://suggestqueries.google.com/complete/search?q={searchTerms}&ds=yt";
|
||||||
URLTemplate = withGoogleFlags "https://www.youtube.com/results?search_query={searchTerms}";
|
URLTemplate = "https://www.youtube.com/results?search_query={searchTerms}";
|
||||||
}
|
}
|
||||||
|
|
||||||
# Forges
|
# Forges
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue