diff --git a/scripts/lang_functions.php b/scripts/lang_functions.php index 5f46d4623..7025faa8e 100644 --- a/scripts/lang_functions.php +++ b/scripts/lang_functions.php @@ -120,8 +120,6 @@ function add_langs_to_config($langs, $config) { function get_langfolder($lang) { $folder = LANGPACKSFOLDER.'/'.str_replace('-', '_', $lang); if (!is_dir($folder) || !is_file($folder.'/langconfig.php')) { - echo "Cannot translate $folder, folder not found"; - return false; } @@ -173,6 +171,8 @@ function reset_translations_strings() { function build_lang($lang, $keys) { $langfoldername = get_langfolder($lang); if (!$langfoldername) { + echo "Cannot translate $lang, folder not found"; + return false; } @@ -182,15 +182,18 @@ function build_lang($lang, $keys) { $override_langfolder = false; } - $total = count ($keys); + $total = count($keys); $local = 0; - $string = get_translation_strings($langfoldername, 'langconfig'); - $parent = isset($string['parentlanguage']) ? $string['parentlanguage'] : ""; + $langparts = explode('-', $lang, 2); + $parentname = $langparts[0] ?? ""; + $parent = ""; echo "Processing $lang"; - if ($parent != "" && $parent != $lang) { - echo " ($parent)"; + // Check parent language exists. + if ($parentname != $lang && get_langfolder($parentname)) { + echo " ($parentname)"; + $parent = $parentname; } $langFile = false; @@ -247,6 +250,12 @@ function build_lang($lang, $keys) { $translations[$key] = html_entity_decode($text); } + if (!empty($parent)) { + $translations['core.parentlanguage'] = $parent; + } else if (isset($translations['core.parentlanguage'])) { + unset($translations['core.parentlanguage']); + } + // Sort and save. ksort($translations); file_put_contents(ASSETSPATH.$lang.'.json', str_replace('\/', '/', json_encode($translations, JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT))); @@ -275,6 +284,8 @@ function progressbar($percentage) { function detect_lang($lang, $keys) { $langfoldername = get_langfolder($lang); if (!$langfoldername) { + echo "Cannot translate $lang, folder not found"; + return false; } diff --git a/src/assets/lang/ca.json b/src/assets/lang/ca.json index 9850d760f..e39398a3c 100644 --- a/src/assets/lang/ca.json +++ b/src/assets/lang/ca.json @@ -1913,7 +1913,6 @@ "core.openmodinbrowser": "Obre {{$a}} al navegador", "core.othergroups": "Altres grups", "core.pagea": "Pàgina {{$a}}", - "core.parentlanguage": "", "core.paymentinstant": "Utilitzeu el botó de baix per pagar i inscriure-us.", "core.percentagenumber": "{{$a}}%", "core.phone": "Telèfon", diff --git a/src/assets/lang/cs.json b/src/assets/lang/cs.json index 8b4fba344..e65bfcaf4 100644 --- a/src/assets/lang/cs.json +++ b/src/assets/lang/cs.json @@ -1909,7 +1909,6 @@ "core.openmodinbrowser": "Otevřít {{$a}} v prohlížeči", "core.othergroups": "Další skupiny", "core.pagea": "Stránka {{$a}}", - "core.parentlanguage": "", "core.paymentinstant": "Pomocí tlačítka níže můžete provést platbu a během několika minut se zapsat do kurzu!", "core.percentagenumber": "{{$a}}%", "core.phone": "Telefon", diff --git a/src/assets/lang/da.json b/src/assets/lang/da.json index d78659458..78425dbfb 100644 --- a/src/assets/lang/da.json +++ b/src/assets/lang/da.json @@ -1752,7 +1752,6 @@ "core.openinbrowser": "Åben i browser", "core.othergroups": "Andre grupper", "core.pagea": "Side {{$a}}", - "core.parentlanguage": "", "core.paymentinstant": "Brug knappen forneden til at betale og blive tilmeldt umiddelbart derefter.", "core.percentagenumber": "{{$a}}%", "core.phone": "Telefon", diff --git a/src/assets/lang/el.json b/src/assets/lang/el.json index 94393e640..46d5af178 100644 --- a/src/assets/lang/el.json +++ b/src/assets/lang/el.json @@ -1841,7 +1841,6 @@ "core.openinbrowser": "Ανοίξτε στον περιηγητή.", "core.othergroups": "Άλλες ομάδες", "core.pagea": "Σελίδα {{$a}}", - "core.parentlanguage": "", "core.paymentinstant": "Χρησιμοποιήστε το παρακάτω πλήκτρο για να πληρώσετε και να εγγραφείτε μέσα σε λίγα λεπτά!", "core.percentagenumber": "{{$a}}%", "core.phone": "Τηλέφωνο", diff --git a/src/assets/lang/en-us.json b/src/assets/lang/en-us.json index c306b3ea8..c8a3e9ae4 100644 --- a/src/assets/lang/en-us.json +++ b/src/assets/lang/en-us.json @@ -14,6 +14,7 @@ "core.listsep": ",", "core.login.loginsteps": "For full access to this site, you first need to create an account.", "core.notenrolledprofile": "This profile is not available because this user is not enrolled in this course.", + "core.parentlanguage": "en", "core.paymentinstant": "Use the button below to pay and be enrolled within minutes!", "core.settings.license": "License", "core.strftimedate": "%B %d, %Y", diff --git a/src/assets/lang/en.json b/src/assets/lang/en.json index a14a93b8e..3ffb8ef88 100644 --- a/src/assets/lang/en.json +++ b/src/assets/lang/en.json @@ -1913,7 +1913,6 @@ "core.openmodinbrowser": "Open {{$a}} in browser", "core.othergroups": "Other groups", "core.pagea": "Page {{$a}}", - "core.parentlanguage": "", "core.paymentinstant": "Use the button below to pay and be enrolled within minutes!", "core.percentagenumber": "{{$a}}%", "core.phone": "Phone", diff --git a/src/assets/lang/es-mx.json b/src/assets/lang/es-mx.json index eeb40e0b4..211c8d9ba 100644 --- a/src/assets/lang/es-mx.json +++ b/src/assets/lang/es-mx.json @@ -1913,7 +1913,7 @@ "core.openmodinbrowser": "Abrir {{$a}} en navegador", "core.othergroups": "Otros grupos", "core.pagea": "Página {{$a}}", - "core.parentlanguage": "", + "core.parentlanguage": "es", "core.paymentinstant": "¡Utilice el botón de abajo para pagar y poder inscribirse en minutos!", "core.percentagenumber": "{{$a}}%", "core.phone": "Teléfono", diff --git a/src/assets/lang/es.json b/src/assets/lang/es.json index f2d9473ad..89a2973e6 100644 --- a/src/assets/lang/es.json +++ b/src/assets/lang/es.json @@ -1913,7 +1913,6 @@ "core.openmodinbrowser": "Abrir {{$a}} en el navegador", "core.othergroups": "Otros grupos", "core.pagea": "Página {{$a}}", - "core.parentlanguage": "", "core.paymentinstant": "¡Utilice el botón de abajo para pagar y poder matricularse en minutos!", "core.percentagenumber": "{{$a}}%", "core.phone": "Teléfono", diff --git a/src/assets/lang/fr.json b/src/assets/lang/fr.json index 8d7cbd4ae..5204cf40f 100644 --- a/src/assets/lang/fr.json +++ b/src/assets/lang/fr.json @@ -1875,7 +1875,6 @@ "core.openinbrowser": "Ouvrir dans le navigateur", "core.othergroups": "Autres groupes", "core.pagea": "Page {{$a}}", - "core.parentlanguage": "", "core.paymentinstant": "Le bouton ci-dessous vous permet de payer et de vous inscrire en quelques minutes !", "core.percentagenumber": "{{$a}} %", "core.phone": "Téléphone", diff --git a/src/assets/lang/hu.json b/src/assets/lang/hu.json index a8c8d802b..fdbe03386 100644 --- a/src/assets/lang/hu.json +++ b/src/assets/lang/hu.json @@ -1521,7 +1521,6 @@ "core.online": "Online", "core.othergroups": "Egyéb csoportok", "core.pagea": "{{$a}} oldal", - "core.parentlanguage": "", "core.paymentinstant": "A fizetéshez és a perceken belüli beiratkozáshoz használja az alábbi gombot!", "core.phone": "Telefon", "core.pictureof": "Kép", diff --git a/src/assets/lang/it.json b/src/assets/lang/it.json index 1cc74ffd6..53a508359 100644 --- a/src/assets/lang/it.json +++ b/src/assets/lang/it.json @@ -1769,7 +1769,6 @@ "core.openinbrowser": "Apri nel browser", "core.othergroups": "Altri gruppi", "core.pagea": "Pagina {{$a}}", - "core.parentlanguage": "", "core.paymentinstant": "Utilizza il pulsante sottostante per pagare ed essere iscritto in pochi minuti!", "core.percentagenumber": "{{$a}}%", "core.phone": "Telefono", diff --git a/src/assets/lang/ja.json b/src/assets/lang/ja.json index 87f66ecec..3a85781f1 100644 --- a/src/assets/lang/ja.json +++ b/src/assets/lang/ja.json @@ -1717,7 +1717,6 @@ "core.openinbrowser": "ブラウザで開く", "core.othergroups": "他のグループ", "core.pagea": "ページ {{$a}}", - "core.parentlanguage": "", "core.paymentinstant": "下のボタンをお使いください。支払いおよび登録がすぐに完了します!", "core.percentagenumber": "{{$a}}%", "core.phone": "電話", diff --git a/src/assets/lang/ko.json b/src/assets/lang/ko.json index 0f58bea81..80a5fd419 100644 --- a/src/assets/lang/ko.json +++ b/src/assets/lang/ko.json @@ -1385,7 +1385,6 @@ "core.openfullimage": "전체 크기 이미지를 보려면 여기를 클릭하십시오.", "core.openinbrowser": "브라우저에서 열기", "core.pagea": "페이지 {{$a}}", - "core.parentlanguage": "", "core.paymentinstant": "신속하게 등록금 지불 및 등록을 마치려면 아래의 버튼을 사용하시오!", "core.percentagenumber": "{{$a}}%", "core.phone": "전화", diff --git a/src/assets/lang/lt.json b/src/assets/lang/lt.json index 7ecff4d19..bac7a4c27 100644 --- a/src/assets/lang/lt.json +++ b/src/assets/lang/lt.json @@ -1634,7 +1634,6 @@ "core.openinbrowser": "Atidaryti naršyklėje", "core.othergroups": "Kitos grupės", "core.pagea": "{{$a}} puslapis", - "core.parentlanguage": "", "core.paymentinstant": "Naudokite toliau pateiktą mygtuką, kad sumokėtumėte ir būtumėte įregistruoti per kelias minutes.", "core.percentagenumber": "{{$a}}%", "core.phone": "Telefonas", diff --git a/src/assets/lang/no.json b/src/assets/lang/no.json index 06d153ab7..b6182efb8 100644 --- a/src/assets/lang/no.json +++ b/src/assets/lang/no.json @@ -1576,7 +1576,6 @@ "core.online": "På nett", "core.othergroups": "Andre grupper", "core.pagea": "Side {{$a}}", - "core.parentlanguage": "", "core.paymentinstant": "Bruk knappen under for å betale og melde deg på kurset.", "core.phone": "Telefon", "core.pictureof": "Bilde av {{$a}}", diff --git a/src/assets/lang/pt-br.json b/src/assets/lang/pt-br.json index 3e9127250..59c1192ae 100644 --- a/src/assets/lang/pt-br.json +++ b/src/assets/lang/pt-br.json @@ -1809,7 +1809,7 @@ "core.openinbrowser": "Abrir no navegador", "core.othergroups": "Outros grupos", "core.pagea": "Página {{$a}}", - "core.parentlanguage": "", + "core.parentlanguage": "pt", "core.paymentinstant": "Clique o botão abaixo para efetuar o pagamento e fazer a sua inscrição em poucos minutos!", "core.percentagenumber": "{{$a}}%", "core.phone": "Fone", diff --git a/src/assets/lang/pt.json b/src/assets/lang/pt.json index 3d497f8cb..d485e3fcd 100644 --- a/src/assets/lang/pt.json +++ b/src/assets/lang/pt.json @@ -1913,7 +1913,6 @@ "core.openmodinbrowser": "Abrir {{$a}} no navegador", "core.othergroups": "Outros grupos", "core.pagea": "Página {{$a}}", - "core.parentlanguage": "", "core.paymentinstant": "Use o botão abaixo para pagar e completar a inscrição!", "core.percentagenumber": "{{$a}}%", "core.phone": "Telefone", diff --git a/src/assets/lang/sl.json b/src/assets/lang/sl.json index 9d131004d..cd4fb87e5 100644 --- a/src/assets/lang/sl.json +++ b/src/assets/lang/sl.json @@ -1841,7 +1841,6 @@ "core.openinbrowser": "Odpri v brskalniku", "core.othergroups": "Ostale skupine", "core.pagea": "Stran {{$a}}", - "core.parentlanguage": "", "core.paymentinstant": "Uporabite spodnje gumbe za plačilo in vpis v nekaj minutah!", "core.percentagenumber": "{{$a}}%", "core.phone": "Telefon", diff --git a/src/assets/lang/sr-cr.json b/src/assets/lang/sr-cr.json index 4b9c044b4..d35fcfcd9 100644 --- a/src/assets/lang/sr-cr.json +++ b/src/assets/lang/sr-cr.json @@ -1700,7 +1700,6 @@ "core.openinbrowser": "Отвори у веб читачу", "core.othergroups": "Друге групе", "core.pagea": "Страница {{$a}}", - "core.parentlanguage": "en", "core.paymentinstant": "Употребите дугме испод како бисте извршили уплату и уписали курс у року од неколико минута!", "core.percentagenumber": "{{$a}}%", "core.phone": "Телефон", diff --git a/src/assets/lang/sr-lt.json b/src/assets/lang/sr-lt.json index b12f5347d..038d60dfc 100644 --- a/src/assets/lang/sr-lt.json +++ b/src/assets/lang/sr-lt.json @@ -1700,7 +1700,6 @@ "core.openinbrowser": "Otvori u veb čitaču", "core.othergroups": "Druge grupe", "core.pagea": "Stranica {{$a}}", - "core.parentlanguage": "en", "core.paymentinstant": "Upotrebite dugme ispod kako biste izvršili uplatu i upisali kurs u roku od nekoliko minuta!", "core.percentagenumber": "{{$a}}%", "core.phone": "Telefon", diff --git a/src/assets/lang/zh-cn.json b/src/assets/lang/zh-cn.json index 2948d13a4..77906091f 100644 --- a/src/assets/lang/zh-cn.json +++ b/src/assets/lang/zh-cn.json @@ -1844,7 +1844,6 @@ "core.openinbrowser": "在浏览器中打开", "core.othergroups": "其他小组", "core.pagea": "页 {{$a}}", - "core.parentlanguage": "", "core.paymentinstant": "点击下面的按钮便可以快速付费并加入课程!", "core.phone": "电话", "core.pictureof": "{{$a}}的头像", diff --git a/src/assets/lang/zh-tw.json b/src/assets/lang/zh-tw.json index 44bc37dea..50fadac48 100644 --- a/src/assets/lang/zh-tw.json +++ b/src/assets/lang/zh-tw.json @@ -1636,7 +1636,6 @@ "core.openinbrowser": "以瀏覽器開啟", "core.othergroups": "其他群組", "core.pagea": "第 {{$a}} 頁", - "core.parentlanguage": "", "core.paymentinstant": "使用以下按鈕立即付款及註冊。", "core.percentagenumber": "{{$a}}%", "core.phone": "電話",