| @@ -5,9 +5,9 @@ | ||
| 5 | 5 | use AcyMailing\Helpers\UpdatemeHelper; |
| 6 | 6 | |
| 7 | 7 | trait Cms |
| 8 | 8 | { |
| 9 | - public function installTables() | |
| 9 | + public function installTables(): void | |
| 10 | 10 | { |
| 11 | 11 | $queries = file_get_contents(ACYM_BACK.'tables.sql'); |
| 12 | 12 | $tables = explode('CREATE TABLE IF NOT EXISTS', $queries); |
| 13 | 13 | |
| @@ -19,9 +19,9 @@ | ||
| 19 | 19 | acym_query('CREATE TABLE IF NOT EXISTS'.$oneTable); |
| 20 | 20 | } |
| 21 | 21 | } |
| 22 | 22 | |
| 23 | - public function installLanguages() | |
| 23 | + public function installLanguages(): void | |
| 24 | 24 | { |
| 25 | 25 | $siteLanguages = acym_getLanguages(); |
| 26 | 26 | if (!empty($siteLanguages[ACYM_DEFAULT_LANGUAGE])) { |
| 27 | 27 | unset($siteLanguages[ACYM_DEFAULT_LANGUAGE]); |
| @@ -27,9 +27,11 @@ | ||
| 27 | 27 | unset($siteLanguages[ACYM_DEFAULT_LANGUAGE]); |
| 28 | 28 | } |
| 29 | 29 | |
| 30 | 30 | $installedLanguages = array_keys($siteLanguages); |
| 31 | - if (empty($installedLanguages) || !class_exists('\AcyMailing\Helpers\UpdatemeHelper')) return; | |
| 31 | + if (empty($installedLanguages) || !class_exists(UpdatemeHelper::class)) { | |
| 32 | + return; | |
| 33 | + } | |
| 32 | 34 | |
| 33 | 35 | ob_start(); |
| 34 | 36 | $languagesContent = UpdatemeHelper::call('public/download/translations?version=latest&codes='.implode(',', $installedLanguages)); |
| 35 | 37 | $warnings = ob_get_clean(); |
| @@ -68,11 +70,14 @@ | ||
| 68 | 70 | if (!empty($error)) acym_enqueueMessage($error, 'error'); |
| 69 | 71 | if (!empty($errorLoad)) acym_enqueueMessage(acym_translationSprintf('ACYM_ERROR_LOAD_LANGUAGE', implode(', ', $errorLoad)), 'warning'); |
| 70 | 72 | } |
| 71 | 73 | |
| 72 | - public function installBackLanguages($onlyCode = '') | |
| 74 | + // translates the Acy menus on back-end and Joomla menus | |
| 75 | + public function installBackLanguages(string $onlyCode = ''): void | |
| 73 | 76 | { |
| 74 | - if (ACYM_CMS !== 'joomla') return; | |
| 77 | + if (ACYM_CMS !== 'joomla') { | |
| 78 | + return; | |
| 79 | + } | |
| 75 | 80 | |
| 76 | 81 | $menuStrings = [ |
| 77 | 82 | 'ACYM_DASHBOARD', |
| 78 | 83 | 'ACYM_SUBSCRIBERS', |
| @@ -106,9 +111,8 @@ | ||
| 106 | 111 | |
| 107 | 112 | $siteLanguages = empty($onlyCode) ? array_keys(acym_getLanguages()) : [$onlyCode]; |
| 108 | 113 | |
| 109 | 114 | foreach ($siteLanguages as $code) { |
| 110 | - | |
| 111 | 115 | $path = acym_getLanguagePath(ACYM_ROOT, $code).DS.$code.'.com_acym.ini'; |
| 112 | 116 | if (!file_exists($path)) continue; |
| 113 | 117 | |
| 114 | 118 | $content = file_get_contents($path); |
| @@ -113,8 +117,11 @@ | ||
| 113 | 117 | |
| 114 | 118 | $content = file_get_contents($path); |
| 115 | 119 | if (empty($content)) continue; |
| 116 | 120 | |
| 121 | + // The first key is to translate "Acym" into "AcyMailing blabla" in the Joomla Extension manager | |
| 122 | + // The second key is to translate "com_acym" into "AcyMailing" in the Joomla global configuration page | |
| 123 | + // DON'T CHANGE THE KEY !! | |
| 117 | 124 | $menuFileContent = 'ACYM="AcyMailing"'."\r\n"; |
| 118 | 125 | $menuFileContent .= 'COM_ACYM="AcyMailing"'."\r\n"; |
| 119 | 126 | $menuFileContent .= 'COM_ACYM_CONFIGURATION="AcyMailing"'."\r\n"; |
| 120 | 127 | |