diff --git a/Admin/Install/db.json b/Admin/Install/db.json index 81afdb9..c7e3788 100644 --- a/Admin/Install/db.json +++ b/Admin/Install/db.json @@ -36,6 +36,48 @@ } } }, + "currency": { + "name": "currency", + "fields": { + "currency_id": { + "name": "currency_id", + "type": "INT", + "null": false, + "primary": true, + "autoincrement": true + }, + "currency_name": { + "name": "currency_name", + "type": "VARCHAR(100)", + "null": false + }, + "currency_num": { + "name": "currency_num", + "type": "VARCHAR(3)", + "null": false + }, + "currency_symbol": { + "name": "currency_symbol", + "type": "VARCHAR(5)", + "null": false + }, + "currency_char": { + "name": "currency_char", + "type": "VARCHAR(3)", + "null": false + }, + "currency_decimals": { + "name": "currency_decimals", + "type": "TINYINT(3)", + "null": false + }, + "currency_subunits": { + "name": "currency_subunits", + "type": "TINYINT(3)", + "null": false + } + } + }, "group": { "name": "group", "fields": { @@ -155,18 +197,32 @@ }, "l11n_country": { "name": "l11n_country", - "type": "VARCHAR(20)", - "null": false + "type": "INT(11)", + "default": null, + "null": true, + "foreignTable": "country", + "foreignKey": "country_id" }, "l11n_language": { "name": "l11n_language", - "type": "VARCHAR(20)", + "type": "INT(11)", + "default": null, + "null": true, + "foreignTable": "language", + "foreignKey": "language_id" + }, + "l11n_datetime": { + "name": "l11n_datetime", + "type": "INT(11)", "null": false }, "l11n_currency": { "name": "l11n_currency", - "type": "VARCHAR(20)", - "null": false + "type": "INT(11)", + "default": null, + "null": true, + "foreignTable": "currency", + "foreignKey": "currency_id" }, "l11n_number_thousand": { "name": "l11n_number_thousand", diff --git a/Models/Localization.php b/Models/Localization.php new file mode 100644 index 0000000..a64a7cc --- /dev/null +++ b/Models/Localization.php @@ -0,0 +1,29 @@ +> + * @since 1.0.0 + */ + protected static array $columns = [ + 'l11n_id' => ['name' => 'l11n_id', 'type' => 'int', 'internal' => 'id'], + 'l11n_country' => ['name' => 'l11n_country', 'type' => 'int', 'internal' => 'country'], + 'l11n_language' => ['name' => 'l11n_language', 'type' => 'int', 'internal' => 'language'], + 'l11n_currency' => ['name' => 'l11n_currency', 'type' => 'int', 'internal' => 'currency'], + 'l11n_datetime' => ['name' => 'l11n_datetime', 'type' => 'int', 'internal' => 'datetime'], + 'l11n_number_thousand' => ['name' => 'l11n_number_thousand', 'type' => 'string', 'internal' => 'thousands'], + 'l11n_number_decimal' => ['name' => 'l11n_number_decimal', 'type' => 'string', 'internal' => 'decimal'], + 'l11n_angle' => ['name' => 'l11n_angle', 'type' => 'string', 'internal' => 'angle'], + 'l11n_temperature' => ['name' => 'l11n_temperature', 'type' => 'string', 'internal' => 'temperature'], + ]; + + /** + * Has one relation. + * + * @var array> + * @since 1.0.0 + */ + protected static array $ownsOne = [ + 'country' => [ + 'mapper' => CountryMapper::class, + 'src' => 'l11n_country', + ], + 'language' => [ + 'mapper' => LanguageMapper::class, + 'src' => 'l11n_language', + ], + 'currency' => [ + 'mapper' => CurrencyMapper::class, + 'src' => 'l11n_currency', + ], + ]; + + /** + * Primary table. + * + * @var string + * @since 1.0.0 + */ + protected static string $table = 'l11n'; + + /** + * Primary field name. + * + * @var string + * @since 1.0.0 + */ + protected static string $primaryField = 'l11n_id'; +} diff --git a/Models/NullLocalization.php b/Models/NullLocalization.php new file mode 100644 index 0000000..2de7849 --- /dev/null +++ b/Models/NullLocalization.php @@ -0,0 +1,27 @@ + [ + ':s1' => 'Active', + ':s2' => 'Inactive', + ':s3' => 'Timeout', + ':s4' => 'Banned', 'Account' => 'Account', 'Account/Group' => 'Account/Group', 'Accounts' => 'Accounts',