Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
W
work.w
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
30
Issues
30
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
osp
work.w
Commits
1ef495d5
Commit
1ef495d5
authored
May 28, 2018
by
alexandre
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
user langage persistence through cookies
parent
c14e4eac
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
12 deletions
+13
-12
playground/static/playground/js/main.js
playground/static/playground/js/main.js
+1
-10
playground/static/playground/js/utils.js
playground/static/playground/js/utils.js
+11
-1
playground/static/playground/js/views.js
playground/static/playground/js/views.js
+1
-1
No files found.
playground/static/playground/js/main.js
View file @
1ef495d5
...
...
@@ -25,17 +25,8 @@ window.W = window.W || {};
// Declares the namespace to Dkango Relational
Backbone
.
Relational
.
store
.
addModelScope
(
W
);
W
.
config
=
W
.
config
||
{};
var
lang
=
W
.
utils
.
getCookie
(
"
lang
"
);
if
(
!
lang
)
{
lang
=
window
.
navigator
.
userLanguage
||
window
.
navigator
.
language
;
lang
=
lang
.
substring
(
0
,
2
)
}
W
.
config
.
lang
=
lang
;
W
.
config
.
lang
=
W
.
utils
.
getUserLanguage
();
var
scoreApp
=
W
.
ScoreApp
.
start
();
...
...
playground/static/playground/js/utils.js
View file @
1ef495d5
;
window
.
W
=
window
.
W
||
{};
window
.
W
.
utils
=
window
.
W
.
utils
||
{};
(
function
(
undefined
)
{
'
use strict
'
;
W
.
utils
=
{};
W
.
utils
.
getUserLanguage
=
function
()
{
var
lang
=
W
.
utils
.
getCookie
(
"
lang
"
);
if
(
!
lang
)
{
lang
=
window
.
navigator
.
userLanguage
||
window
.
navigator
.
language
;
lang
=
lang
.
substring
(
0
,
2
)
}
return
lang
;
}
W
.
utils
.
translate
=
window
.
t
=
function
(
string
)
{
if
(
!
(
W
.
config
.
lang
in
W
.
lang
))
{
...
...
playground/static/playground/js/views.js
View file @
1ef495d5
...
...
@@ -1722,9 +1722,9 @@ window.W = window.W || {};
switchLanguage
:
function
(
view
,
event
)
{
W
.
config
.
lang
=
$
(
event
.
currentTarget
).
attr
(
"
data-lang
"
);
var
lang
=
W
.
utils
.
setCookie
(
"
lang
"
,
W
.
config
.
lang
);
_
.
each
(
this
.
getRegions
(),
function
(
element
,
index
,
list
)
{
console
.
log
(
element
);
var
currentView
=
element
.
currentView
;
if
(
currentView
)
{
currentView
.
render
();
}
});
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment