Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
Romain Courteaud
erp5
Commits
783b2235
Commit
783b2235
authored
Oct 15, 2021
by
Romain Courteaud
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
erp5_web_renderjs_ui: do not activate translation if the erp5js site is a Web Section
Prevent generating wrong urls for now
parent
f240d910
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
14 deletions
+19
-14
bt5/erp5_web_renderjs_ui/SkinTemplateItem/portal_skins/erp5_web_renderjs/WebSection_getPrecacheManifest.py
...skins/erp5_web_renderjs/WebSection_getPrecacheManifest.py
+1
-1
bt5/erp5_web_renderjs_ui/SkinTemplateItem/portal_skins/erp5_web_renderjs_ui/WebSection_renderDefaultPageAsGadget.py
...5_web_renderjs_ui/WebSection_renderDefaultPageAsGadget.py
+18
-13
No files found.
bt5/erp5_web_renderjs_ui/SkinTemplateItem/portal_skins/erp5_web_renderjs/WebSection_getPrecacheManifest.py
View file @
783b2235
...
...
@@ -171,7 +171,7 @@ default_url = './'
available_language_set
=
web_section
.
getLayoutProperty
(
"available_language_set"
,
default
=
[
'en'
])
default_language
=
web_section
.
getLayoutProperty
(
"default_available_language"
,
default
=
'en'
)
for
language
in
available_language_set
:
if
language
==
default_language
:
if
(
language
==
default_language
)
or
(
web_section
.
getPortalType
()
==
'Web Section'
)
:
url_list
.
append
(
default_url
)
else
:
url_list
.
append
(
'%s/'
%
language
)
...
...
bt5/erp5_web_renderjs_ui/SkinTemplateItem/portal_skins/erp5_web_renderjs_ui/WebSection_renderDefaultPageAsGadget.py
View file @
783b2235
...
...
@@ -15,27 +15,32 @@ portal = context.getPortalObject()
default_language
=
web_section
.
getLayoutProperty
(
"default_available_language"
,
default
=
'en'
)
website_url_set
=
{}
#simplify code of Base_doLanguage, can't ues Base_doLanguage directly
root_website_url
=
web_section
.
getOriginalDocument
().
absolute_url
()
website_url_pattern
=
r'^%s(?:%s)*(/|$)'
%
(
re
.
escape
(
root_website_url
),
'|'
.
join
(
'/'
+
re
.
escape
(
x
)
for
x
in
available_language_set
))
selected_language
=
portal
.
Localizer
.
get_selected_language
()
if
(
web_section
.
getPortalType
()
==
'Web Section'
):
# do not allow language echange
website_url_set
[
selected_language
]
=
web_section
.
absolute_url
()
+
'/'
available_language_set
=
[
selected_language
]
else
:
#simplify code of Base_doLanguage, can't ues Base_doLanguage directly
root_website_url
=
web_section
.
getOriginalDocument
().
absolute_url
()
website_url_pattern
=
r'^%s(?:%s)*(/|$)'
%
(
re
.
escape
(
root_website_url
),
'|'
.
join
(
'/'
+
re
.
escape
(
x
)
for
x
in
available_language_set
))
for
language
in
available_language_set
:
if
language
==
default_language
:
website_url_set
[
language
]
=
re
.
sub
(
website_url_pattern
,
r'%s/\1'
%
root_website_url
,
web_section
.
absolute_url
())
else
:
website_url_set
[
language
]
=
re
.
sub
(
website_url_pattern
,
r'%s/%s/\1'
%
(
root_website_url
,
language
),
web_section
.
absolute_url
())
for
language
in
available_language_set
:
if
language
==
default_language
:
website_url_set
[
language
]
=
re
.
sub
(
website_url_pattern
,
r'%s/\1'
%
root_website_url
,
web_section
.
absolute_url
())
else
:
website_url_set
[
language
]
=
re
.
sub
(
website_url_pattern
,
r'%s/%s/\1'
%
(
root_website_url
,
language
),
web_section
.
absolute_url
())
view_as_web_method
=
default_web_page
.
getTypeBasedMethod
(
"viewAsWeb"
,
fallback_script_id
=
"WebPage_viewAsWeb"
)
selected_language
=
portal
.
Localizer
.
get_selected_language
()
# base tag
if
selected_language
==
default_language
:
if
(
selected_language
==
default_language
)
or
(
web_section
.
getPortalType
()
==
'Web Section'
)
:
base_prefix
=
""
else
:
base_prefix
=
'../'
...
...
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