diff --git a/Web/Presenters/AboutPresenter.php b/Web/Presenters/AboutPresenter.php index 411b01de..1a919e4d 100644 --- a/Web/Presenters/AboutPresenter.php +++ b/Web/Presenters/AboutPresenter.php @@ -54,17 +54,20 @@ final class AboutPresenter extends OpenVKPresenter function renderVersion(): void { $this->template->themes = Themepacks::i()->getAllThemes(); + $this->template->languages = getLanguages(); } function renderLanguage(): void { + $this->template->languages = getLanguages(); + if(!is_null($_GET['lg'])){ - Session::i()->set("lang", $_GET['lg']); + setLanguage($_GET['lg']); } } function renderSandbox(): void { - $this->template->manager = (new Managers)->get(4); + $this->template->languages = getLanguages(); } } diff --git a/Web/Presenters/templates/About/Language.xml b/Web/Presenters/templates/About/Language.xml index 9331757a..121452f0 100644 --- a/Web/Presenters/templates/About/Language.xml +++ b/Web/Presenters/templates/About/Language.xml @@ -7,16 +7,8 @@ {block content} {/block} diff --git a/Web/Presenters/templates/About/Sandbox.xml b/Web/Presenters/templates/About/Sandbox.xml index 05219cc7..b84b515a 100644 --- a/Web/Presenters/templates/About/Sandbox.xml +++ b/Web/Presenters/templates/About/Sandbox.xml @@ -6,5 +6,5 @@ {/block} {block content} - {$manager->getUser()->getFullName()} + {php var_dump($languages)} {/block} diff --git a/Web/Presenters/templates/About/Version.xml b/Web/Presenters/templates/About/Version.xml index ea8697c8..752829c2 100644 --- a/Web/Presenters/templates/About/Version.xml +++ b/Web/Presenters/templates/About/Version.xml @@ -410,48 +410,26 @@ - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + {foreach $languages as $language} + + + + + + {/foreach}
LanguagepacksLanguagepacks
Language + Native name + Author
RussianVladimir Barinov (veselcraft)
EnglishVladimir Barinov (veselcraft)
BelarussianDaniil Myslivets (myslivets) and MoccoCoffee
SerbianIvan Denisov (Dma Games)
TurkishBedirhan Kurt (WindOWZ)
Armenianapeeh
GermanSamyoFox
UkrainianAndrej Lenťaj
{$language['name']}{$language['native_name']}{$language['author']}
diff --git a/bootstrap.php b/bootstrap.php index 070dbc4f..a257f483 100644 --- a/bootstrap.php +++ b/bootstrap.php @@ -96,6 +96,16 @@ function tr(string $stringId, ...$variables): string return $output; } +function setLanguage($lg): void +{ + Session::i()->set("lang", $lg); +} + +function getLanguages(): array +{ + return yaml_parse_file(OPENVK_ROOT . "/locales/list.yml")['list']; +} + function eventdb(): ?DatabaseConnection { $conf = OPENVK_ROOT_CONF["openvk"]["credentials"]["eventDB"]; diff --git a/locales/list.yml b/locales/list.yml new file mode 100644 index 00000000..f66fb75a --- /dev/null +++ b/locales/list.yml @@ -0,0 +1,57 @@ +list: + - code: "ru" + flag: "ru" + name: "Russian" + native_name: "Русский" + author: "OpenVK Team" + - code: "en" + flag: "us" + name: "English" + native_name: "English" + author: "OpenVK Team" + - code: "ua" + flag: "ua" + name: "Ukrainian" + native_name: "Україньска" + author: "Andrej Lenťaj and Maxim Hrabovi (dechioyo)" + - code: "by" + flag: "by" + name: "Belarussian" + native_name: "Беларуская (Наркамоўка)" + author: "Daniil Myslivets (myslivets) and MoccoCoffee" + - code: "by_lat" + flag: "by" + name: "Belarussian (Latin)" + native_name: "Biełaruskaja (Łacinka)" + author: "MoccoCoffee" + - code: "pl" + flag: "pl" + name: "Polish" + native_name: "Polski" + author: "Kirill (mbsoft)" + - code: "de" + flag: "de" + name: "German" + native_name: "Deutsch" + author: "SamyoFox" + - code: "am" + flag: "am" + name: "Armenian" + native_name: "Հայերեն" + author: "LifesMinder (apeeh)" + - code: "sr_cyr" + flag: "rs" + name: "Serbian (cyrillic)" + native_name: "Спрски (Ћирилица)" + author: "Ivan Denisov (Dma Games)" + - code: "sr_lat" + flag: "rs" + name: "Serbian (latin)" + native_name: "Sprski (Latinica)" + author: "Ivan Denisov (Dma Games)" + - code: "tr" + flag: "tr" + name: "Turkish" + native_name: "Türkçe" + author: "Bedirhan Kurt (WindOWZ)" +