$code = $this->toISO6391($code);
$native = $iso639->nativeByCode1($code);
$language = $iso639->languageByCode1($code);
- if ($native != $iso639->languageByCode1($code) && $international) {
+ if ($native != $language && $international) {
$languages[$code] = $this->t('%s (%s)', $native, $language);
} else {
$languages[$code] = $native;
$used_languages = '';
foreach (json_decode($item['language'], true) as $language => $reliability) {
- $used_languages .= $iso639->nativeByCode1(substr($language, 0, 2)) . ' (' . $iso639->languageByCode1(substr($language, 0, 2)) . ' - ' . $language . "): " . number_format($reliability, 5) . '\n';
+ $code = DI::l10n()->toISO6391($language);
+
+ $native = $iso639->nativeByCode1($code);
+ $language = $iso639->languageByCode1($code);
+ if ($native != $language) {
+ $used_languages .= DI::l10n()->t('%s (%s - %s): %s', $native, $language, $code, number_format($reliability, 5)) . '\n';
+ } else {
+ $used_languages .= DI::l10n()->t('%s (%s): %s', $native, $code, number_format($reliability, 5)) . '\n';
+ }
}
$used_languages = DI::l10n()->t('Detected languages in this post:\n%s', $used_languages);
return $used_languages;
// First day of the week (0 = Sunday)
$firstDay = DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'calendar', 'first_day_of_week', 0);
- $lang = substr(DI::l10n()->getCurrentLang(), 0, 2);
+ $lang = DI::l10n()->toISO6391(DI::l10n()->getCurrentLang());
// Check if the detected language is supported by the picker
if (!in_array($lang,