]> Skullheadx's Git Forge - surf.git/commitdiff
Add webkit language settings
authorQuentin Rameau <quinq@fifth.space>
Sun, 22 Nov 2015 18:13:48 +0000 (19:13 +0100)
committerQuentin Rameau <quinq@fifth.space>
Sun, 22 Nov 2015 18:13:48 +0000 (19:13 +0100)
You can now set your prefered website languages in order.
It is also possible to enable spell checking in the same way.

config.def.h
surf.c

index 94eb2883896ea5c93755a7b01978893c6a6d2a7c..4f6d655c08e280bf870ddb264f26b9f1f500614c 100644 (file)
@@ -18,6 +18,11 @@ static char *cookiepolicies = "Aa@"; /* A: accept all; a: accept nothing,
                                       * @: accept no third party */
 static int strictssl       = 0; /* Refuse untrusted SSL connections */
 
+/* Languages */
+static int enablespellchecking         = 0;
+static const char *spellinglanguages[] = { "en_US", NULL };
+static const char *preferedlanguages[] = { NULL };
+
 /* Webkit default features */
 static int enablescrollbars      = 1;
 static int enablecaretbrowsing   = 1;
diff --git a/surf.c b/surf.c
index 93111d4a8782c14790647ce0e37ec311b07ae88c..180f6e4c9aca2fb4aeba2eab75d834cf25b1e23a 100644 (file)
--- a/surf.c
+++ b/surf.c
@@ -726,6 +726,13 @@ newview(Client *c, WebKitWebView *rv)
                webkit_cookie_manager_set_accept_policy(
                    webkit_web_context_get_cookie_manager(context),
                    cookiepolicy_get());
+               /* languages */
+               webkit_web_context_set_preferred_languages(context,
+                                                          preferedlanguages);
+               webkit_web_context_set_spell_checking_languages(context,
+                   spellinglanguages);
+               webkit_web_context_set_spell_checking_enabled(context,
+                   enablespellchecking);
 
                g_signal_connect(G_OBJECT(context), "download-started",
                                 G_CALLBACK(downloadstarted), c);