mirror of
https://codeberg.org/leana8959/.files.git
synced 2025-12-06 06:39: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
|
||||
mkLrFlag = languageRestrictions:
|
||||
"&lr=" + lib.escapeURL (builtins.concatStringsSep "|" languageRestrictions);
|
||||
|
||||
mkGlFlag = preferredCountry:
|
||||
"&gl=" + preferredCountry;
|
||||
|
||||
mkHlFlag = hostLanguage:
|
||||
"&hl=" + hostLanguage;
|
||||
in {
|
||||
programs.firefox = {
|
||||
enable = true;
|
||||
|
|
@ -23,30 +17,30 @@ in {
|
|||
RequestedLocales = ["fr" "en-US" "zh-TW"];
|
||||
|
||||
SearchEngines = {
|
||||
Default = "Google Customized";
|
||||
Default = "Google EN";
|
||||
Remove = ["Google"];
|
||||
Add = let
|
||||
withGoogleFlags = x:
|
||||
x
|
||||
+ mkLrFlag ["lang_fr" "lang_en" "lang_zh-TW"]
|
||||
+ mkGlFlag "fr"
|
||||
+ mkHlFlag "fr";
|
||||
in [
|
||||
# Google and its evil empire™
|
||||
{
|
||||
Name = "Google Customized";
|
||||
Alias = "G";
|
||||
langs = ["lang_fr" "lang_en" "lang_zh-TW"];
|
||||
in
|
||||
# Google specialized for each language
|
||||
map (lang: let
|
||||
shortcode = lib.substring 0 2 (lib.removePrefix "lang_" lang);
|
||||
in {
|
||||
Name = "Google " + lib.toUpper shortcode;
|
||||
Alias = "G" + shortcode;
|
||||
IconURL = "https://google.com/favicon.ico";
|
||||
Description = "Your data yum yum";
|
||||
SuggestURLTemplate = withGoogleFlags "https://suggestqueries.google.com/complete/search?q={searchTerms}";
|
||||
URLTemplate = withGoogleFlags "https://google.com/search?q={searchTerms}";
|
||||
}
|
||||
Description = "Your data yum yum (but ${shortcode})";
|
||||
SuggestURLTemplate = "https://suggestqueries.google.com/complete/search?q={searchTerms}" + mkLrFlag [lang];
|
||||
URLTemplate = "https://google.com/search?q={searchTerms}" + mkLrFlag [lang];
|
||||
})
|
||||
langs
|
||||
++ [
|
||||
{
|
||||
Name = "YouTube";
|
||||
Alias = "yt";
|
||||
IconURL = "https://youtube.com/favicon.ico";
|
||||
SuggestURLTemplate = withGoogleFlags "http://suggestqueries.google.com/complete/search?q={searchTerms}&ds=yt";
|
||||
URLTemplate = withGoogleFlags "https://www.youtube.com/results?search_query={searchTerms}";
|
||||
SuggestURLTemplate = "http://suggestqueries.google.com/complete/search?q={searchTerms}&ds=yt";
|
||||
URLTemplate = "https://www.youtube.com/results?search_query={searchTerms}";
|
||||
}
|
||||
|
||||
# Forges
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue