diff options
-rw-r--r-- | webapp/cao-common.js | 7 | ||||
-rw-r--r-- | webapp/cao-config.js | 13 | ||||
-rw-r--r-- | webapp/cao-mobile.html | 1 |
3 files changed, 21 insertions, 0 deletions
diff --git a/webapp/cao-common.js b/webapp/cao-common.js index 6d92de7..0ec516d 100644 --- a/webapp/cao-common.js +++ b/webapp/cao-common.js @@ -28,6 +28,8 @@ var CAO = function() { var self = this; var ws; + var lang; + var nbr_played_cards = 0; var played_cards = []; @@ -39,6 +41,10 @@ var CAO = function() { var map_handle_response_ok = {}; var map_handle_notif = {}; + this.set_lang = function(language) { + lang = language; + }; + this.is_judge = function() { return judge; }; @@ -287,6 +293,7 @@ var CAO = function() { var request = { 'op': 'join_game', 'game_name': game_name, + 'lang': lang, }; request_queue.push('join_game'); ws.send(JSON.stringify(request)); diff --git a/webapp/cao-config.js b/webapp/cao-config.js new file mode 100644 index 0000000..2082e3a --- /dev/null +++ b/webapp/cao-config.js @@ -0,0 +1,13 @@ +$(document).ready(function() { + var lang; + var hostname = document.location.hostname; + + /* XXX replace this with your desired behaviour */ + if (hostname.startsWith('fr.')) { + lang = 'fr'; + } else if (hostname.startsWith('en.')) { + lang = 'en'; + } + + cao.set_lang(lang); +}); diff --git a/webapp/cao-mobile.html b/webapp/cao-mobile.html index a9f8722..7aa619d 100644 --- a/webapp/cao-mobile.html +++ b/webapp/cao-mobile.html @@ -8,6 +8,7 @@ <link rel="stylesheet" href="cao-mobile.css"> <script src="jquery.js"></script> <script src="cao-common.js"></script> + <script src="cao-config.js"></script> <script src="cao-mobile.js"></script> </head> <body> |