diff --git a/js/components/header.js b/js/components/header.js
index 6863dc5d..c9755b9a 100644
--- a/js/components/header.js
+++ b/js/components/header.js
@@ -91,6 +91,15 @@ let Header = React.createClass({
);
},
+ getLangSelector() {
+ return (
+
+
+
+
+ );
+ },
+
onMenuItemClick() {
/*
This is a hack to make the dropdown close after clicking on an item
@@ -217,6 +226,7 @@ let Header = React.createClass({
{account}
{signup}
+ {this.getLangSelector()}
{navRoutesLinks}
diff --git a/js/constants/languages.js b/js/constants/languages.js
index a0a5a0e1..50e0fd0b 100644
--- a/js/constants/languages.js
+++ b/js/constants/languages.js
@@ -230,7 +230,9 @@ const languages = {
'Welcome to ascribe': 'Welcome to ascribe',
'CREATE EDITIONS': 'CREATE EDITIONS',
'Remove Piece': 'Remove Piece',
- 'Admin email': 'admin@bokk.io'
+ 'Admin email': 'admin@bokk.io',
+ 'Lang Label FR': 'FR',
+ 'Lang Label EN': 'EN'
},
'de': {
'ID': 'ID',
@@ -461,7 +463,9 @@ const languages = {
'Welcome to ascribe': 'Welcome to ascribe',
'CREATE EDITIONS': 'CREATE EDITIONS',
'Remove Piece': 'Remove Piece',
- 'Admin email': 'admin@bokk.io'
+ 'Admin email': 'admin@bokk.io',
+ 'Lang Label FR': 'FR',
+ 'Lang Label EN': 'EN'
},
'fr': {
'ID': 'ID',
@@ -692,7 +696,9 @@ const languages = {
'Welcome to ascribe': 'Welcome to ascribe',
'CREATE EDITIONS': 'CREATE EDITIONS',
'Remove Piece': 'Remove Piece',
- 'Admin email': 'admin@bokk.io'
+ 'Admin email': 'admin@bokk.io',
+ 'Lang Label FR': 'FR',
+ 'Lang Label EN': 'EN'
}
};
diff --git a/js/utils/lang_utils.js b/js/utils/lang_utils.js
index ee2d292c..6c101a83 100644
--- a/js/utils/lang_utils.js
+++ b/js/utils/lang_utils.js
@@ -8,8 +8,38 @@ import { formatText } from './general_utils';
export function getLang() {
// this is just for testing, as changing the navigator.language wasn't possible
// return 'fr';
- return navigator.languages ? navigator.languages[0] :
- (navigator.language || navigator.userLanguage);
+ //return navigator.languages ? navigator.languages[0] :
+ // (navigator.language || navigator.userLanguage);
+ var siteLang=getCookie("sitelang");
+ if (siteLang != "") {
+ return siteLang;
+ } else {
+ return 'fr';
+ }
+}
+
+export function getCookie(cname) {
+ var name = cname + "=";
+ var ca = document.cookie.split(';');
+ for(var i = 0; i < ca.length; i++) {
+ var c = ca[i];
+ while (c.charAt(0) == ' ') {
+ c = c.substring(1);
+ }
+ if (c.indexOf(name) == 0) {
+ return c.substring(name.length, c.length);
+ }
+ }
+ return "";
+}
+
+
+export function setCookie(cname,cvalue,exdays) {
+ var d = new Date();
+ d.setTime(d.getTime() + (exdays*24*60*60*1000));
+ var expires = "expires=" + d.toGMTString();
+ document.cookie = cname + "=" + cvalue + ";" + expires + ";path=/";
+ location.reload();
}
/**