You are here: Foswiki>Tasks Web>Item15058 (28 Mar 2022, MichaelDaum)Edit Attach

Item15058: script tags for javascrit i18n should not use src attribute

pencil
Priority: Normal
Current State: Closed
Released In: 2.1.7
Target Release: patch
Applies To: Extension
Component: JQueryPlugin
Branches:
Reported By: MichaelDaum
Waiting For:
Last Change By: MichaelDaum
jquery modules that come with i18n definitions were added in this format:

<script type='application/l10n' data-i18n-language='de' data-i18n-namespace='SOMEPLUGIN' src='/pub/System/SomePlugin/i18n/de.js' ></script>
<script type='application/l10n' data-i18n-language='en' data-i18n-namespace='SOMEPLUGIN' src='/pub/System/SomePlugin/i18n/en.js' ></script>

However any script tag with a src attribute is treated as a javascript asset and directly downloaded by the browser. Also https://validator.w3.org/ warns about it using a non-empty unrecognized type attribute. These specific script tags of type application/l10n are pointing to json definitions of string mappings for the given language and namespace. To make its use standard conforming again the src attribute should be a data-src attribute:

<script type='application/l10n' data-i18n-language='de' data-i18n-namespace='SOMEPLUGIN' data-src='/pub/System/SomePlugin/i18n/de.js' ></script>
<script type='application/l10n' data-i18n-language='en' data-i18n-namespace='SOMEPLUGIN' data-src='/pub/System/SomePlugin/i18n/en.js' ></script>

If data-src is not present it will fall back to src.

See System.JQueryI18N for more info.

-- MichaelDaum - 05 Jan 2022

 

ItemTemplate edit

Summary script tags for javascrit i18n should not use src attribute
ReportedBy MichaelDaum
Codebase
SVN Range
AppliesTo Extension
Component JQueryPlugin
Priority Normal
CurrentState Closed
WaitingFor
Checkins
TargetRelease patch
ReleasedIn 2.1.7
CheckinsOnBranches
trunkCheckins
masterCheckins
ItemBranchCheckins
Release02x01Checkins
Release02x00Checkins
Release01x01Checkins
Topic revision: r4 - 28 Mar 2022, MichaelDaum
The copyright of the content on this website is held by the contributing authors, except where stated elsewhere. See Copyright Statement. Creative Commons License    Legal Imprint    Privacy Policy