diff options
author | Harald Eilertsen <haraldei@anduin.net> | 2024-07-24 11:46:18 +0200 |
---|---|---|
committer | Harald Eilertsen <haraldei@anduin.net> | 2024-07-24 11:46:18 +0200 |
commit | 61f9ad8274d662a056aff05407771fb450a2ab35 (patch) | |
tree | 6f65e2155680993e370dab51c512d7c9da925be4 /Zotlabs | |
parent | 7067a0adc2e37168401e761c29e78392229ec168 (diff) | |
download | volse-hubzilla-61f9ad8274d662a056aff05407771fb450a2ab35.tar.gz volse-hubzilla-61f9ad8274d662a056aff05407771fb450a2ab35.tar.bz2 volse-hubzilla-61f9ad8274d662a056aff05407771fb450a2ab35.zip |
Add a notice to help pages when defaulting to english.
Diffstat (limited to 'Zotlabs')
-rw-r--r-- | Zotlabs/Lib/Traits/HelpHelperTrait.php | 26 |
1 files changed, 18 insertions, 8 deletions
diff --git a/Zotlabs/Lib/Traits/HelpHelperTrait.php b/Zotlabs/Lib/Traits/HelpHelperTrait.php index 2a54e2db2..0ce586d08 100644 --- a/Zotlabs/Lib/Traits/HelpHelperTrait.php +++ b/Zotlabs/Lib/Traits/HelpHelperTrait.php @@ -20,6 +20,7 @@ trait HelpHelperTrait { private array $lang = [ 'language' => 'en', //! Detected language, 2-letter ISO 639-1 code ("en") 'from_url' => false, //! true if language from URL overrides browser default + 'missing' => false, //! true if topic not found in detected language ]; /** @@ -36,17 +37,15 @@ trait HelpHelperTrait { $languages = $language_repository->getList(); if(array_key_exists(argv(1), $languages)) { - $lang = argv(1); - $from_url = true; + $this->lang['language'] = argv(1); + $this->lang['from_url'] = true; } else { - $lang = \App::$language; - if(! isset($lang)) - $lang = 'en'; + if(isset(\App::$language)) { + $this->lang['language'] = \App::$language; + } - $from_url = false; + $this->lang['from_url'] = false; } - - $this->lang = array('language' => $lang, 'from_url' => $from_url); } /** @@ -74,7 +73,18 @@ trait HelpHelperTrait { } if (empty($this->file_name) && $lang !== 'en') { + $this->lang['missing'] = true; $this->find_help_file($base_path, 'en'); } } + + public function missing_translation(): bool { + return !!$this->lang['missing']; + } + + public function missing_translation_message(): string { + return bbcode( + t("This page is not yet available in your preferred language. See [observer.baseurl]/help/developer/developer_guide#Translations for information about how to help.") + ); + } } |