PageSourceSearch

https://jlabs.online/jlabs/i18n.js

js jlabs.online collected 2026-10-02 00:38:54 UTC 7,127 bytes, 240 lines download raw bytes

1const LANGUAGE_STORAGE_KEY = "jlabs_language";
2
3const translations = {
4  EN: {
5    Header: {
6      Landing: "",
7      About: "About Us",
8      Games: "Games",
9      Contact: "Contact",
10    },
11    Footer: {
12      Tagline: "",
13      About: "About Us",
14      Games: "Games",
15      Contact: "Contact",
16      Copyright: "",
17    },
18    Home: {
19      Hero: {
20        Tagline: "The formula for fun: unique games!",
21        Title: "",
22        Subtitle: "",
23        ExploreGames: "Explore Games",
24        Contact: "",
25      },
26      Games: {
27        SectionTagline: "",
28        SectionTitle: "Every Detail Engineered for Fun",
29        SectionSubtitle:
30          "In this lab, games are carefully designed and continuously refined to deliver a truly unique experience.",
31        RefereeTitle: "Football Referee Simulator",
32        RefereeDescription:
33          "The hardest job on the field, are you ready to referee?",
34        AirportDeputyTitle: "Airport Security",
35        AirportDeputyDescription:
36          "Control every document, guard every gate, the safety of the skies is in your hands.",
37      },
38      Download: {
39        Title: "Are you ready to experience our games?",
40        Subtitle:
41          "Discover our top-rated games and join millions of players worldwide. Download today and start your journey!",
42        AppStoreTop: "",
43        AppStoreBottom: "Download on the App Store",
44        GooglePlayTop: "",
45        GooglePlayBottom: "Download on Google Play",
46      },
47    },
48    Contact: {
49      Hero: {
50        Eyebrow: "",
51        Title: "Contact Us",
52        Description:
53          "Feel free to contact us for your questions or collaboration offers",
54        Note: "",
55      },
56      Form: {
57        Title: "Contact Form",
58        NameLabel: "Name - Surname",
59        NamePlaceholder: "Your Name and Surname",
60        EmailLabel: "Email",
61        EmailPlaceholder: "[email protected]",
62        MessageLabel: "Message",
63        MessagePlaceholder: "Write your message..",
64        Meta: "",
65        Submit: "Send",
66      },
67      Cards: {
68        StudioTitle: "",
69        StudioCompany: "Jlabs Teknoloji Anonim Şirketi",
70        StudioAddressLine1:
71          "Pinarbasi Mah. Hurriyet Cad. Antalya Teknokent Ulugbey Ar-Ge 2 Binasi No:3a",
72        StudioAddressLine2: "Ic Kapi No:B25 Konyaalti / Antalya",
73        StudioVat: "VAT Number: 4831319998",
74        EmailTitle: "Email Address",
75        EmailDescription: "[email protected]",
76        EmailCopy: "",
77        EmailCopied: "",
78      },
79    },
80  },
81  TR: {
82    Header: {
83      Landing: "",
84      About: "Hakkımızda",
85      Games: "Oyunlar",
86      Contact: "İletişim",
87    },
88    Footer: {
89      Tagline: "",
90      About: "Hakkımızda",
91      Games: "Oyunlar",
92      Contact: "İletişim",
93      Copyright: "",
94    },
95    Home: {
96      Hero: {
97        Tagline: "Eğlenmenin formülü; eşsiz oyunlar!",
98        Title: "",
99        Subtitle: "",
100        ExploreGames: "Oyunları Keşfet",
101        Contact: "",
102      },
103      Games: {
104        SectionTagline: "",
105        SectionTitle: "Her detay, eğlence için tasarlandı",
106        SectionSubtitle:
107          "Bu laboratuvarda oyunlar titizlikle tasarlanır ve oyunculara eşsiz bir eğlence sunmak için sürekli geliştirilir.",
108        RefereeTitle: "Football Referee Simulator",
109        RefereeDescription:
110          "Yeşil sahada en zor koltuk: Hakem olmaya hazır mısın?",
111        AirportDeputyTitle: "Airport Security",
112        AirportDeputyDescription:
113          "Her belgeyi kontrol et, her kapıyı koru, gökyüzünün güvenliği senin elinde.",
114      },
115      Download: {
116        Title: "Oyunlarımızı deneyimlemeye hazır mısınız?",
117        Subtitle:
118          "En sevilen oyunlarımıza göz atın ve eğlenceye dilediğiniz her yerden ortak olun. Hemen indirin ve maceraya başlayın!",
119        AppStoreTop: "",
120        AppStoreBottom: "App Store'dan İndirin",
121        GooglePlayTop: "",
122        GooglePlayBottom: "Google Play'den İndirin",
123      },
124    },
125    Contact: {
126      Hero: {
127        Eyebrow: "",
128        Title: "Bizimle İletişime Geç",
129        Description:
130          "Sorularınız veya işbirliği teklifleriniz için bizimle iletişime geçmekten çekinmeyin",
131        Note: "",
132      },
133      Form: {
134        Title: "İletişim Formu",
135        NameLabel: "Ad - Soyad",
136        NamePlaceholder: "Adınız",
137        EmailLabel: "E-posta Adresi",
138        EmailPlaceholder: "[email protected]",
139        MessageLabel: "Mesaj",
140        MessagePlaceholder: "Mesajınızı yazın..",
141        Meta: "",
142        Submit: "Gönder",
143      },
144      Cards: {
145        StudioTitle: "",
146        StudioCompany: "Jlabs Teknoloji Anonim Şirketi",
147        StudioAddressLine1:
148          "Pinarbasi Mah. Hurriyet Cad. Antalya Teknokent Ulugbey Ar-Ge 2 Binasi No:3A",
149        StudioAddressLine2: "Ic Kapi No:B25 Konyaalti / Antalya",
150        StudioVat: "Vergi No: 4831319998",
151        EmailTitle: "E-posta Adresi",
152        EmailDescription: "[email protected]",
153        EmailCopy: "",
154        EmailCopied: "",
155      },
156    },
157  },
158};
159
160export function getCurrentLanguage() {
161  if (typeof window === "undefined") return "EN";
162  const stored = window.localStorage.getItem(LANGUAGE_STORAGE_KEY);
163  if (stored && translations[stored]) {
164    return stored;
165  }
166  return "EN";
167}
168
169export function setLanguage(lang) {
170  if (!translations[lang]) return;
171  if (typeof window === "undefined") return;
172  window.localStorage.setItem(LANGUAGE_STORAGE_KEY, lang);
173}
174
175export function translate(key) {
176  const lang = getCurrentLanguage();
177  const dict = translations[lang];
178  if (!dict) return "";
179
180  const parts = key.split(".");
181  let current = dict;
182
183  for (const part of parts) {
184    if (current && Object.prototype.hasOwnProperty.call(current, part)) {
185      current = current[part];
186    } else {
187      return "";
188    }
189  }
190
191  if (typeof current === "string") {
192    return current;
193  }
194
195  return "";
196}
197
198export function applyTranslations(root = document) {
199  if (typeof document === "undefined" || !root) return;
200
201  const elements = root.querySelectorAll("[data-i18n]");
202  elements.forEach((el) => {
203    const key = el.getAttribute("data-i18n");
204    if (!key) return;
205    const value = translate(key);
206    if (!value) return;
207
208    if (el.dataset.i18nHtml === "true") {
209      el.innerHTML = value;
210    } else {
211      el.textContent = value;
212    }
213  });
214}
215
216export function initLanguageControls() {
217  const langToggle = document.getElementById("langToggle");
218  const currentLang = document.getElementById("currentLang");
219  const mobileCurrentLang = document.getElementById("mobileCurrentLang");
220
221  const syncUI = () => {
222    const lang = getCurrentLanguage();
223    const short = lang === "TR" ? "TR" : "EN";
224    if (currentLang) currentLang.textContent = short;
225    if (mobileCurrentLang) mobileCurrentLang.textContent = short;
226    applyTranslations(document);
227  };
228
229  if (langToggle) {
230    langToggle.addEventListener("click", () => {
231      const current = getCurrentLanguage();
232      const next = current === "EN" ? "TR" : "EN";
233      setLanguage(next);
234      syncUI();
235    });
236  }
237
238  syncUI();
239}
240

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.