Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
U
uffd
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Operate
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Luca (strifel)
uffd
Commits
01123c36
Commit
01123c36
authored
3 years ago
by
Julian
Browse files
Options
Downloads
Patches
Plain Diff
Disabled German translations by default and fixed language selection in this case
parent
39794116
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
uffd/__init__.py
+2
-3
2 additions, 3 deletions
uffd/__init__.py
uffd/default_config.cfg
+5
-4
5 additions, 4 deletions
uffd/default_config.cfg
uffd/templates/base.html
+2
-2
2 additions, 2 deletions
uffd/templates/base.html
with
9 additions
and
9 deletions
uffd/__init__.py
+
2
−
3
View file @
01123c36
...
...
@@ -129,10 +129,9 @@ def create_app(test_config=None): # pylint: disable=too-many-locals
@babel.localeselector
def
get_locale
():
#pylint: disable=unused-variable
language_cookie
=
request
.
cookies
.
get
(
'
language
'
)
if
language_cookie
is
not
None
:
if
language_cookie
is
not
None
and
language_cookie
in
app
.
config
[
'
LANGUAGES
'
]
:
return
language_cookie
languages
=
list
(
map
(
lambda
x
:
x
.
get
(
'
value
'
),
app
.
config
[
'
LANGUAGES
'
]))
return
request
.
accept_languages
.
best_match
(
languages
)
return
request
.
accept_languages
.
best_match
(
list
(
app
.
config
[
'
LANGUAGES
'
]))
app
.
add_template_global
(
get_locale
)
...
...
This diff is collapsed.
Click to expand it.
uffd/default_config.cfg
+
5
−
4
View file @
01123c36
...
...
@@ -53,10 +53,11 @@ SESSION_COOKIE_SECURE=True
SESSION_COOKIE_HTTPONLY
=
True
SESSION_COOKIE_SAMESITE
=
'Strict'
LANGUAGES
=
[
{
"value":
"de",
"display":
"DE"
},
{
"value":
"en",
"display":
"EN"
}
]
LANGUAGES
=
{
# Language identifier (see Accept-Language HTTP header) -> Display Name
"en":
"EN",
#"de": "DE", # Too incomplete right now to enable per default
}
ACL_ADMIN_GROUP
=
"uffd_admin"
ACL_SELFSERVICE_GROUP
=
"uffd_access"
...
...
This diff is collapsed.
Click to expand it.
uffd/templates/base.html
+
2
−
2
View file @
01123c36
...
...
@@ -76,8 +76,8 @@
<form
class=
"language-switch py-2 pr-1"
method=
"POST"
style=
"margin-left: -5px;"
action=
"{{ url_for('setlang') }}"
>
<input
type=
"hidden"
name=
"ref"
value=
"{{ request.url }}"
>
<select
name=
"lang"
class=
"bg-dark"
style=
"border: 0px; color: rgba(255, 255, 255, 0.5);"
onchange=
"$('.language-switch').submit()"
>
{% for
languag
e in config['LANGUAGES'] %}
<option
value=
"{{
language['value']
}}"
{{
'
selected
'
if
language
['
value
'
]
=
=
get_locale
()
}}
>
{{
language['display']
}}
</option>
{% for
identifier, nam
e in config['LANGUAGES']
.items()
%}
<option
value=
"{{
identifier
}}"
{{
'
selected
'
if
identifier
=
=
get_locale
()
}}
>
{{
name
}}
</option>
{% endfor %}
</select>
<noscript>
...
...
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