diff --git a/addons/survey/static/src/js/survey_result.js b/addons/survey/static/src/js/survey_result.js index e6a8905c209..c70280c727e 100644 --- a/addons/survey/static/src/js/survey_result.js +++ b/addons/survey/static/src/js/survey_result.js @@ -1,7 +1,7 @@ /** @odoo-module **/ import { _t } from "@web/core/l10n/translation"; -import { loadBundle, loadJS } from "@web/core/assets"; +import { loadBundle } from "@web/core/assets"; import { SurveyImageZoomer } from "@survey/js/survey_image_zoomer"; import publicWidget from "@web/legacy/js/public/public_widget"; @@ -482,15 +482,6 @@ publicWidget.registry.SurveyResultWidget = publicWidget.Widget.extend({ // Widget //-------------------------------------------------------------------------- - /** - * @override - */ - willStart: function () { - var url = '/web/webclient/locale/' + (document.documentElement.getAttribute('lang') || 'en_US').replace('-', '_'); - var localeReady = loadJS(url); - return Promise.all([this._super.apply(this, arguments), localeReady]); - }, - /** * @override */ diff --git a/addons/web/controllers/webclient.py b/addons/web/controllers/webclient.py index a2fdfe10492..a1b29354cb0 100644 --- a/addons/web/controllers/webclient.py +++ b/addons/web/controllers/webclient.py @@ -29,32 +29,11 @@ def CONTENT_MAXAGE(): return http.STATIC_CACHE_LONG -MOMENTJS_LANG_CODES_MAP = { - "sr_RS": "sr_cyrl", - "sr@latin": "sr" -} - - class WebClient(http.Controller): + # FIXME: to be removed in master, deprecated since momentjs removal in commit 4327c062d820 @http.route('/web/webclient/locale/', type='http', auth="none") def load_locale(self, lang): - lang = MOMENTJS_LANG_CODES_MAP.get(lang, lang) - magic_file_finding = [lang.replace("_", '-').lower(), lang.split('_')[0]] - for code in magic_file_finding: - try: - return http.Response( - werkzeug.wsgi.wrap_file( - request.httprequest.environ, - file_open(f'web/static/lib/moment/locale/{code}.js', 'rb') - ), - content_type='application/javascript; charset=utf-8', - headers=[('Cache-Control', f'max-age={http.STATIC_CACHE}')], - direct_passthrough=True, - ) - except IOError: - _logger.debug("No moment locale for code %s", code) - return request.make_response("", headers=[ ('Content-Type', 'application/javascript'), ('Cache-Control', f'max-age={http.STATIC_CACHE}'), diff --git a/addons/web/static/src/legacy/js/public/public_root.js b/addons/web/static/src/legacy/js/public/public_root.js index a87c2d1a98e..86793f50a8c 100644 --- a/addons/web/static/src/legacy/js/public/public_root.js +++ b/addons/web/static/src/legacy/js/public/public_root.js @@ -8,7 +8,7 @@ import { registry } from '@web/core/registry'; import lazyloader from "@web/legacy/js/public/lazyloader"; import { makeEnv, startServices } from "@web/env"; -import { loadJS, templates } from '@web/core/assets'; +import { templates } from '@web/core/assets'; import { MainComponentsContainer } from "@web/core/main_components_container"; import { browser } from '@web/core/browser/browser'; import { _t } from "@web/core/l10n/translation"; @@ -24,8 +24,6 @@ function getLang() { return (html.getAttribute('lang') || 'en_US').replace('-', '_'); } const lang = cookie.get('frontend_lang') || getLang(); // FIXME the cookie value should maybe be in the ctx? -// momentjs don't have config for en_US, so avoid useless RPC -var localeDef = lang !== 'en_US' ? loadJS('/web/webclient/locale/' + lang.replace('-', '_')) : Promise.resolve(); /** @@ -55,16 +53,6 @@ export const PublicRoot = publicWidget.RootWidget.extend({ this.env = env; this.publicWidgets = []; }, - /** - * @override - */ - willStart: function () { - // TODO would be even greater to wait for localeDef only when necessary - return Promise.all([ - this._super.apply(this, arguments), - localeDef - ]); - }, /** * @override */