Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Gutyán Gábor
/
circlestack
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
cfac8389
authored
Apr 17, 2014
by
Kálmán Viktor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
circle: use django-statici18n to generate js i18n
parent
cf578809
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
221 additions
and
10 deletions
+221
-10
circle/circle/settings/local.py
+5
-0
circle/circle/urls.py
+0
-9
circle/dashboard/static/jsi18n/en/djangojs.js
+87
-0
circle/dashboard/static/jsi18n/hu/djangojs.js
+127
-0
circle/dashboard/templates/base.html
+1
-1
requirements/local.txt
+1
-0
No files found.
circle/circle/settings/local.py
View file @
cfac8389
...
@@ -78,3 +78,8 @@ for i in LOCAL_APPS:
...
@@ -78,3 +78,8 @@ for i in LOCAL_APPS:
LOGGING
[
'loggers'
][
i
]
=
{
'handlers'
:
[
'console'
],
'level'
:
'DEBUG'
}
LOGGING
[
'loggers'
][
i
]
=
{
'handlers'
:
[
'console'
],
'level'
:
'DEBUG'
}
CRISPY_FAIL_SILENTLY
=
not
DEBUG
CRISPY_FAIL_SILENTLY
=
not
DEBUG
# generate new static js i18n files only on devenv
INSTALLED_APPS
+=
(
"statici18n"
,
)
circle/circle/urls.py
View file @
cfac8389
...
@@ -11,12 +11,6 @@ from dashboard.forms import CirclePasswordResetForm, CircleSetPasswordForm
...
@@ -11,12 +11,6 @@ from dashboard.forms import CirclePasswordResetForm, CircleSetPasswordForm
admin
.
autodiscover
()
admin
.
autodiscover
()
# TODO cache
# docs.djangoproject.com/en/1.5/topics/i18n/translation/#note-on-performance
js_info_dict
=
{
'packages'
:
(
"dashboard"
,
"network"
,
),
}
urlpatterns
=
patterns
(
urlpatterns
=
patterns
(
''
,
''
,
#url(r'^$', TemplateView.as_view(template_name='base.html')),
#url(r'^$', TemplateView.as_view(template_name='base.html')),
...
@@ -32,9 +26,6 @@ urlpatterns = patterns(
...
@@ -32,9 +26,6 @@ urlpatterns = patterns(
url
(
r'^network/'
,
include
(
'network.urls'
)),
url
(
r'^network/'
,
include
(
'network.urls'
)),
url
(
r'^dashboard/'
,
include
(
'dashboard.urls'
)),
url
(
r'^dashboard/'
,
include
(
'dashboard.urls'
)),
url
(
r'^jsi18n/$'
,
'django.views.i18n.javascript_catalog'
,
js_info_dict
,
name
=
"js-i18n"
),
url
((
r'^accounts/reset/(?P<uidb36>[0-9A-Za-z]{1,13})-'
url
((
r'^accounts/reset/(?P<uidb36>[0-9A-Za-z]{1,13})-'
'(?P<token>[0-9A-Za-z]{1,13}-[0-9A-Za-z]{1,20})/$'
),
'(?P<token>[0-9A-Za-z]{1,13}-[0-9A-Za-z]{1,20})/$'
),
'django.contrib.auth.views.password_reset_confirm'
,
'django.contrib.auth.views.password_reset_confirm'
,
...
...
circle/dashboard/static/jsi18n/en/djangojs.js
0 → 100644
View file @
cfac8389
(
function
(
globals
)
{
var
django
=
globals
.
django
||
(
globals
.
django
=
{});
django
.
pluralidx
=
function
(
count
)
{
return
(
count
==
1
)
?
0
:
1
;
};
/* gettext identity library */
django
.
gettext
=
function
(
msgid
)
{
return
msgid
;
};
django
.
ngettext
=
function
(
singular
,
plural
,
count
)
{
return
(
count
==
1
)
?
singular
:
plural
;
};
django
.
gettext_noop
=
function
(
msgid
)
{
return
msgid
;
};
django
.
pgettext
=
function
(
context
,
msgid
)
{
return
msgid
;
};
django
.
npgettext
=
function
(
context
,
singular
,
plural
,
count
)
{
return
(
count
==
1
)
?
singular
:
plural
;
};
django
.
interpolate
=
function
(
fmt
,
obj
,
named
)
{
if
(
named
)
{
return
fmt
.
replace
(
/%
\(\w
+
\)
s/g
,
function
(
match
){
return
String
(
obj
[
match
.
slice
(
2
,
-
2
)])});
}
else
{
return
fmt
.
replace
(
/%s/g
,
function
(
match
){
return
String
(
obj
.
shift
())});
}
};
/* formatting library */
django
.
formats
=
{
"DATETIME_FORMAT"
:
"N j, Y, P"
,
"DATETIME_INPUT_FORMATS"
:
[
"%Y-%m-%d %H:%M:%S"
,
"%Y-%m-%d %H:%M"
,
"%Y-%m-%d"
,
"%m/%d/%Y %H:%M:%S"
,
"%m/%d/%Y %H:%M"
,
"%m/%d/%Y"
,
"%m/%d/%y %H:%M:%S"
,
"%m/%d/%y %H:%M"
,
"%m/%d/%y"
,
"%Y-%m-%d %H:%M:%S.%f"
],
"DATE_FORMAT"
:
"N j, Y"
,
"DATE_INPUT_FORMATS"
:
[
"%Y-%m-%d"
,
"%m/%d/%Y"
,
"%m/%d/%y"
],
"DECIMAL_SEPARATOR"
:
"."
,
"FIRST_DAY_OF_WEEK"
:
"0"
,
"MONTH_DAY_FORMAT"
:
"F j"
,
"NUMBER_GROUPING"
:
"3"
,
"SHORT_DATETIME_FORMAT"
:
"m/d/Y P"
,
"SHORT_DATE_FORMAT"
:
"m/d/Y"
,
"THOUSAND_SEPARATOR"
:
","
,
"TIME_FORMAT"
:
"P"
,
"TIME_INPUT_FORMATS"
:
[
"%H:%M:%S"
,
"%H:%M"
],
"YEAR_MONTH_FORMAT"
:
"F Y"
};
django
.
get_format
=
function
(
format_type
)
{
var
value
=
django
.
formats
[
format_type
];
if
(
typeof
(
value
)
==
'undefined'
)
{
return
format_type
;
}
else
{
return
value
;
}
};
/* add to global namespace */
globals
.
pluralidx
=
django
.
pluralidx
;
globals
.
gettext
=
django
.
gettext
;
globals
.
ngettext
=
django
.
ngettext
;
globals
.
gettext_noop
=
django
.
gettext_noop
;
globals
.
pgettext
=
django
.
pgettext
;
globals
.
npgettext
=
django
.
npgettext
;
globals
.
interpolate
=
django
.
interpolate
;
globals
.
get_format
=
django
.
get_format
;
}(
this
));
circle/dashboard/static/jsi18n/hu/djangojs.js
0 → 100644
View file @
cfac8389
(
function
(
globals
)
{
var
django
=
globals
.
django
||
(
globals
.
django
=
{});
django
.
pluralidx
=
function
(
n
)
{
var
v
=
(
n
!=
1
);
if
(
typeof
(
v
)
==
'boolean'
)
{
return
v
?
1
:
0
;
}
else
{
return
v
;
}
};
/* gettext library */
django
.
catalog
=
{
"Next"
:
"K\u00f6vetkez\u0151"
,
"Prev"
:
"El\u0151z\u0151"
};
django
.
gettext
=
function
(
msgid
)
{
var
value
=
django
.
catalog
[
msgid
];
if
(
typeof
(
value
)
==
'undefined'
)
{
return
msgid
;
}
else
{
return
(
typeof
(
value
)
==
'string'
)
?
value
:
value
[
0
];
}
};
django
.
ngettext
=
function
(
singular
,
plural
,
count
)
{
var
value
=
django
.
catalog
[
singular
];
if
(
typeof
(
value
)
==
'undefined'
)
{
return
(
count
==
1
)
?
singular
:
plural
;
}
else
{
return
value
[
django
.
pluralidx
(
count
)];
}
};
django
.
gettext_noop
=
function
(
msgid
)
{
return
msgid
;
};
django
.
pgettext
=
function
(
context
,
msgid
)
{
var
value
=
django
.
gettext
(
context
+
'\x04'
+
msgid
);
if
(
value
.
indexOf
(
'\x04'
)
!=
-
1
)
{
value
=
msgid
;
}
return
value
;
};
django
.
npgettext
=
function
(
context
,
singular
,
plural
,
count
)
{
var
value
=
django
.
ngettext
(
context
+
'\x04'
+
singular
,
context
+
'\x04'
+
plural
,
count
);
if
(
value
.
indexOf
(
'\x04'
)
!=
-
1
)
{
value
=
django
.
ngettext
(
singular
,
plural
,
count
);
}
return
value
;
};
django
.
interpolate
=
function
(
fmt
,
obj
,
named
)
{
if
(
named
)
{
return
fmt
.
replace
(
/%
\(\w
+
\)
s/g
,
function
(
match
){
return
String
(
obj
[
match
.
slice
(
2
,
-
2
)])});
}
else
{
return
fmt
.
replace
(
/%s/g
,
function
(
match
){
return
String
(
obj
.
shift
())});
}
};
/* formatting library */
django
.
formats
=
{
"DATETIME_FORMAT"
:
"Y. F j. G.i.s"
,
"DATETIME_INPUT_FORMATS"
:
[
"%Y.%m.%d. %H.%M.%S"
,
"%Y.%m.%d. %H.%M"
,
"%Y.%m.%d."
,
"%Y-%m-%d %H:%M:%S"
,
"%Y-%m-%d %H:%M:%S.%f"
,
"%Y-%m-%d %H:%M"
,
"%Y-%m-%d"
],
"DATE_FORMAT"
:
"Y. F j."
,
"DATE_INPUT_FORMATS"
:
[
"%Y.%m.%d."
,
"%Y-%m-%d"
],
"DECIMAL_SEPARATOR"
:
","
,
"FIRST_DAY_OF_WEEK"
:
"1"
,
"MONTH_DAY_FORMAT"
:
"F j."
,
"NUMBER_GROUPING"
:
"3"
,
"SHORT_DATETIME_FORMAT"
:
"Y.m.d. G.i.s"
,
"SHORT_DATE_FORMAT"
:
"Y.m.d."
,
"THOUSAND_SEPARATOR"
:
"\u00a0"
,
"TIME_FORMAT"
:
"G.i.s"
,
"TIME_INPUT_FORMATS"
:
[
"%H.%M.%S"
,
"%H.%M"
,
"%H:%M:%S"
,
"%H:%M"
],
"YEAR_MONTH_FORMAT"
:
"Y. F"
};
django
.
get_format
=
function
(
format_type
)
{
var
value
=
django
.
formats
[
format_type
];
if
(
typeof
(
value
)
==
'undefined'
)
{
return
format_type
;
}
else
{
return
value
;
}
};
/* add to global namespace */
globals
.
pluralidx
=
django
.
pluralidx
;
globals
.
gettext
=
django
.
gettext
;
globals
.
ngettext
=
django
.
ngettext
;
globals
.
gettext_noop
=
django
.
gettext_noop
;
globals
.
pgettext
=
django
.
pgettext
;
globals
.
npgettext
=
django
.
npgettext
;
globals
.
interpolate
=
django
.
interpolate
;
globals
.
get_format
=
django
.
get_format
;
}(
this
));
circle/dashboard/templates/base.html
View file @
cfac8389
...
@@ -20,7 +20,7 @@
...
@@ -20,7 +20,7 @@
<link
href=
"{{ STATIC_URL }}dashboard/bootstrap-tour.min.css"
rel=
"stylesheet"
>
<link
href=
"{{ STATIC_URL }}dashboard/bootstrap-tour.min.css"
rel=
"stylesheet"
>
<link
href=
"{{ STATIC_URL }}dashboard/dashboard.css"
rel=
"stylesheet"
>
<link
href=
"{{ STATIC_URL }}dashboard/dashboard.css"
rel=
"stylesheet"
>
<script
src=
"{{ STATIC_URL }}dashboard/dashboard.js"
></script>
<script
src=
"{{ STATIC_URL }}dashboard/dashboard.js"
></script>
<script
src=
"{
% url "
js-i18n
"
%}
"
></script>
<script
src=
"{
{ STATIC_URL }}jsi18n/{{ LANGUAGE_CODE }}/djangojs.js
"
></script>
</head>
</head>
<body>
<body>
...
...
requirements/local.txt
View file @
cfac8389
...
@@ -4,3 +4,4 @@ coverage==3.6
...
@@ -4,3 +4,4 @@ coverage==3.6
django-discover-runner==0.4
django-discover-runner==0.4
django-debug-toolbar==0.9.4
django-debug-toolbar==0.9.4
Sphinx==1.2b1
Sphinx==1.2b1
django-statici18n==1.1
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