1/** 2 * @file 3 * Attaches behaviors for Drupal's active link marking. 4 */ 5 6(function (Drupal) { 7 Drupal.st = async function (id, parameters, domain, locale) { 8 domain = domain || 'messages'; 9 locale = locale || document.documentElement.lang; 10 11 if (!window.symfonyTranslations) { 12 window.symfonyTranslations = {}; 13 } 14 15 if (!symfonyTranslations[domain] || !symfonyTranslations[domain][locale]) { 16 const translations = await fetch(`/symfony-translation/translations/${domain}/${locale}`) 17 .then(response => response.json()); 18 19 if (!symfonyTranslations[domain]) { 20 symfonyTranslations[domain] = {}; 21 } 22 23 symfonyTranslations[domain][locale] = translations; 24 } 25 26 let str = id; 27 28 if (symfonyTranslations[domain] && symfonyTranslations[domain][locale] && symfonyTranslations[domain][locale][id]) { 29 str = symfonyTranslations[domain][locale][id]; 30 } 31 32 if (parameters) { 33 str = Drupal.formatString(str, parameters); 34 } 35 36 return str; 37 }; 38})(Drupal);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.