PageSourceSearch

https://auth.holdemmanager.com/js/modules/translations.js

js holdemmanager.com collected 2026-10-03 22:04:45 UTC 834 bytes, 30 lines download raw bytes

1/* jshint esversion: 6 */
2/* jshint strict: global */
3"use strict";
4
5let translations = {};
6
7function getHtmlLang() {
8    const langAttr = document.documentElement.getAttribute('lang') || 'en';
9    return langAttr;
10}
11
12export async function loadTranslations() {
13    const lang = getHtmlLang();
14    const res = await fetch(`/ajax/translations?lang=${encodeURIComponent(lang)}`);
15    if (!res.ok) {
16        console.error(`Failed to load translations for lang: ${lang}`);
17        translations = {};
18        return;
19    }
20    let response = await res.json();
21    translations = response.messages;
22}
23
24export function trans(key, params = {}) {
25    let value = translations[key] || key;
26    for (const [placeholder, val] of Object.entries(params)) {
27        value = value.replace(new RegExp(placeholder, 'g'), val);
28    }
29    return value;
30}

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.