[I18N] Added ability to call _m_dynamic from any class, allowing it to define translations for dynamic-valued calls to _m

This commit is contained in:
Hugo Sales
2020-06-05 23:04:49 +00:00
committed by Hugo Sales
parent 5be901f9ce
commit 711af58dcd
3 changed files with 68 additions and 15 deletions

View File

@@ -32,6 +32,7 @@
namespace App\Core\DB;
use function App\Core\I18n\_m;
use App\Core\I18n\I18nHelper;
use App\Util\Common;
@@ -304,4 +305,18 @@ abstract class DefaultSettings
DB::getConnection()->executeQuery($sql);
}
}
public static function _m_dynamic(): array
{
self::setDefaults();
$m = [];
$m['domain'] = 'core';
foreach (self::$defaults as $key => $inner) {
$m[] = _m($key);
foreach (array_keys($inner) as $inner_key) {
$m[] = _m($inner_key);
}
}
return $m;
}
}