Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
V
VIPSWeb
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
VIPS
VIPSWeb
Commits
fbe5d88a
Commit
fbe5d88a
authored
9 years ago
by
Tor-Einar Skog
Browse files
Options
Downloads
Patches
Plain Diff
Internationalized SITE_OWNER_NAME
parent
ce3e56bb
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
VIPSWeb/local_settings_sample.py
+1
-1
1 addition, 1 deletion
VIPSWeb/local_settings_sample.py
VIPSWeb/templates/base.html
+2
-2
2 additions, 2 deletions
VIPSWeb/templates/base.html
VIPSWeb/templatetags/template_helper.py
+23
-0
23 additions, 0 deletions
VIPSWeb/templatetags/template_helper.py
with
26 additions
and
3 deletions
VIPSWeb/local_settings_sample.py
+
1
−
1
View file @
fbe5d88a
...
@@ -108,7 +108,7 @@ VIPSCOREMANAGER_SSLCERT_PATH = None
...
@@ -108,7 +108,7 @@ VIPSCOREMANAGER_SSLCERT_PATH = None
VIPSLOGIC_DATE_FORMAT
=
"
%Y-%m-%d
"
VIPSLOGIC_DATE_FORMAT
=
"
%Y-%m-%d
"
# Site owner info
# Site owner info
SITE_OWNER_NAME
=
"
FooBar Inc
"
SITE_OWNER_NAME
=
{
"
en
"
:
"
FooBar Inc
"
,
"
nb
"
:
"
ACME industrier
"
}
SITE_OWNER_URL
=
"
http://www.example.com/
"
SITE_OWNER_URL
=
"
http://www.example.com/
"
# OpenLayers Map initial configuration
# OpenLayers Map initial configuration
...
...
This diff is collapsed.
Click to expand it.
VIPSWeb/templates/base.html
+
2
−
2
View file @
fbe5d88a
...
@@ -97,8 +97,8 @@
...
@@ -97,8 +97,8 @@
</div>
<!-- End contents container -->
</div>
<!-- End contents container -->
</div>
<!-- End row with sidebar and contents container -->
</div>
<!-- End row with sidebar and contents container -->
<footer>
<footer>
<p>
©
{% now "Y" %}
<a
href=
"{{settings.SITE_OWNER_URL}}"
target=
"new"
>
{
{
settings.SITE_OWNER_NAME
}
}
</a></p>
<p>
©
{% now "Y" %}
<a
href=
"{{settings.SITE_OWNER_URL}}"
target=
"new"
>
{
% get_text_i18n
settings.SITE_OWNER_NAME
%
}
</a></p>
{% get_
footer_
text_i18n %}
{% get_text_i18n
settings.FOOTER_HTML
%}
</footer>
</footer>
</div>
</div>
<!-- end contentwrapper-->
<!-- end contentwrapper-->
...
...
This diff is collapsed.
Click to expand it.
VIPSWeb/templatetags/template_helper.py
+
23
−
0
View file @
fbe5d88a
...
@@ -76,6 +76,8 @@ def generate_main_menu(context):
...
@@ -76,6 +76,8 @@ def generate_main_menu(context):
return
menu_html
return
menu_html
# Get the footer text in correct language
# Get the footer text in correct language
# REPLACED WITH THE MORE FLEXIBLE get_text_i18(text_dict) BELOW
"""
@register.simple_tag()
@register.simple_tag()
def get_footer_text_i18n():
def get_footer_text_i18n():
# Absolute fallback is the empty string
# Absolute fallback is the empty string
...
@@ -91,6 +93,27 @@ def get_footer_text_i18n():
...
@@ -91,6 +93,27 @@ def get_footer_text_i18n():
footer_html = settings.FOOTER_HTML[settings.FOOTER_HTML.keys()[0]]
footer_html = settings.FOOTER_HTML[settings.FOOTER_HTML.keys()[0]]
return footer_html if footer_html != None else
""
return footer_html if footer_html != None else
""
"""
# Get text in correct language
# Assuming text is on format{"LANGCODE":"CONTENTS","LANGCODE":"CONTENTS"}
@register.simple_tag
def
get_text_i18n
(
text_dict
):
# If no dictionary, return as-is
if
not
isinstance
(
text_dict
,
dict
):
return
text_dict
text
=
None
# Languages in preferred order: user's selected language, default language of site, English
language_candidates
=
[
translation
.
get_language
(),
settings
.
LANGUAGE_CODE
,
"
en
"
]
for
language_candidate
in
language_candidates
:
if
text_dict
.
get
(
language_candidate
,
None
)
!=
None
:
text
=
text_dict
.
get
(
language_candidate
,
text_dict
)
break
# Fallback: First item in list
if
text
==
None
and
len
(
text_dict
.
keys
())
>
0
:
text
=
text_dict
[
text_dict
.
keys
()[
0
]]
return
text
if
text
!=
None
else
""
@register.simple_tag
@register.simple_tag
def
get_system_time
(
format_string
):
def
get_system_time
(
format_string
):
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment