When JavaScript aggregation is enabled on a site using a locally-hosted library its language files (and probably some other files) can't be loaded from the library. The main timeline.js script gets aggregated too. When it initializes, it sets its location to the site's files directory where the aggregated file is cached and tries to dynamically load other library files from that same directory. Of course, they aren't located there.

Proposed Solution

TimelineJS has a setting for specifying the location of the library files. I didn't previously know what this setting was made for, but it seems to have been created for this exact situation. The plugin should automatically set this value whenever the library files are served locally.

Original Report

After enabling language NL on my site, i noticed that my already working timeline was showing an error
Could not load language ["nl"]: Not Found

load error

I found out this message originates from sites\all\libraries\TimelineJS3\source\js\language\TL.Language.js
where some ajax call is performed in case language differs from 'en', and returns a response > 200.

In an effort to debug this piece of JS, i had to first disable my Advanced Aggregation setting (provided by https://www.drupal.org/project/advagg).
This action seemed to solve the occurring error.
After some tweaking i found out the error was caused by the enabled "Fix improperly set type" in the AdvAgg JS settings
fix set type

I'm not an aggregation specialist and the symptoms it may cause, but i thought it might be useful sharing this information.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

RAWDESK created an issue. See original summary.

dcam’s picture

Title: Could not load language ["nl"] with advanced aggregation enabled » JS aggregation breaks language file loading for locally-stored libraries
Version: 7.x-3.0 » 8.x-3.x-dev
Priority: Normal » Major
Issue summary: View changes
Issue tags: -javascript error, -library api, -ajax error

Actually, the problem isn't exclusive to site using Advanced Aggregation or that setting. It occurs when using core's built-in JS aggregation too.

dcam’s picture

FileSize
2.93 KB

D8 patch, not that it matters since we don't have any tests for the module yet.

  • dcam committed 2b84429 on 8.x-3.x
    Issue #2841773 by dcam: JS aggregation breaks language file loading for...
dcam’s picture

Version: 8.x-3.x-dev » 7.x-3.x-dev
dcam’s picture

Well, I take that back partly. D8's core aggregation will aggregate JS from other libraries, but D7's won't. D7 must have Advanced Aggregation enabled to reproduce the issue. The fix is still the same.

dcam’s picture

FileSize
1.2 KB

D7 patch.

  • dcam committed 3aad2d5 on 7.x-3.x
    Issue #2841773 by dcam: JS aggregation breaks language file loading for...
dcam’s picture

Status: Active » Fixed
dcam’s picture

Unless there's an additional bug report in the next few days then then these will be the last changes to go into the 3.1 releases. 8.x-3.1 and 7.x-3.1 will be released on the 3.0 launch anniversary, October 10.

RAWDESK’s picture

@dcam Reviewed and tested patch #7.
Works like a charm.
Thanks for the fix!

dcam’s picture

No problem. Thank you for testing it.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

giufog’s picture

FileSize
105.13 KB
27.99 KB

Good morning to all, I installed Views TimelineJS 7.x-3.1 but still gives me the error reported at the beginning, it appears when the language is not English

dcam’s picture

@giufog Are you using the Advanced Aggregation module to aggregate your site's JS?