implement localization installation

This commit is contained in:
Dennis Eichhorn 2020-02-08 16:48:32 +01:00
parent 425751e915
commit c3369ea432
3 changed files with 39 additions and 28 deletions

View File

@ -22,7 +22,8 @@
"country_code2": {
"name": "country_code2",
"type": "VARCHAR(2)",
"null": false
"null": false,
"unique": true
},
"country_code3": {
"name": "country_code3",
@ -97,7 +98,8 @@
"language_639_2T": {
"name": "language_639_2T",
"type": "VARCHAR(2)",
"null": false
"null": false,
"unique": true
},
"language_639_2B": {
"name": "language_639_2B",
@ -134,21 +136,27 @@
"currency_symbol": {
"name": "currency_symbol",
"type": "VARCHAR(5)",
"null": false
"null": true
},
"currency_code": {
"name": "currency_code",
"type": "VARCHAR(3)",
"null": false
"null": false,
"unique": true
},
"currency_decimals": {
"name": "currency_decimals",
"currency_decimal": {
"name": "currency_decimal",
"type": "VARCHAR(10)",
"null": false
},
"currency_subunits": {
"name": "currency_subunits",
"type": "TINYINT(3)",
"type": "INT(11)",
"null": true
},
"currency_countries": {
"name": "currency_countries",
"type": "TEXT",
"null": false
}
}
@ -165,19 +173,19 @@
},
"l11n_country": {
"name": "l11n_country",
"type": "INT(11)",
"type": "VARCHAR(2)",
"default": null,
"null": true,
"foreignTable": "country",
"foreignKey": "country_id"
"foreignKey": "country_code2"
},
"l11n_language": {
"name": "l11n_language",
"type": "INT(11)",
"type": "VARCHAR(2)",
"default": null,
"null": true,
"foreignTable": "language",
"foreignKey": "language_id"
"foreignKey": "language_639_2T"
},
"l11n_datetime": {
"name": "l11n_datetime",
@ -187,11 +195,11 @@
},
"l11n_currency": {
"name": "l11n_currency",
"type": "INT(11)",
"type": "VARCHAR(3)",
"default": null,
"null": true,
"foreignTable": "currency",
"foreignKey": "currency_id"
"foreignKey": "currency_code"
},
"l11n_number_thousand": {
"name": "l11n_number_thousand",

View File

@ -75,10 +75,10 @@ final class Installer extends InstallerAbstract
foreach ($countries as $country) {
$query->values(
$country['country_name'],
$country['country_name'],
$country['country_code2'],
$country['country_code3'],
$country['country_name'] === null ? null : \trim($country['country_name']),
$country['country_name'] === null ? null : \trim($country['country_name']),
$country['country_code2'] === null ? null : \trim($country['country_code2']),
$country['country_code3'] === null ? null : \trim($country['country_code3']),
$country['country_numeric']
);
}
@ -110,11 +110,11 @@ final class Installer extends InstallerAbstract
foreach ($languages as $language) {
$query->values(
$language['language_name'],
$language['language_native'],
$language['language_639_2T'],
$language['language_639_2B'],
$language['language_639_3']
$language['language_name'] === null ? null : \trim($language['language_name']),
$language['language_native'] === null ? null : \trim($language['language_native']),
$language['language_639_2T'] === null ? null : \trim($language['language_639_2T']),
$language['language_639_2B'] === null ? null : \trim($language['language_639_2B']),
$language['language_639_3'] === null ? null : \trim($language['language_639_3'])
);
}
@ -146,13 +146,13 @@ final class Installer extends InstallerAbstract
foreach ($currencies as $currency) {
$query->values(
$currency['currency_id'],
$currency['currency_name'],
$currency['currency_code'],
$currency['currency_number'],
$currency['currency_symbol'],
$currency['currency_name'] === null ? null : \trim($currency['currency_name']),
$currency['currency_code'] === null ? null : \trim($currency['currency_code']),
$currency['currency_number'] === null ? null : \trim($currency['currency_number']),
$currency['currency_symbol'] === null ? null : \trim($currency['currency_symbol']),
$currency['currency_subunits'],
$currency['currency_decimal'],
$currency['currency_countries']
$currency['currency_decimal'] === null ? null : \trim($currency['currency_decimal']),
$currency['currency_countries'] === null ? null : \trim($currency['currency_countries'])
);
}

View File

@ -39,6 +39,9 @@ final class LocalizationMapper extends DataMapperAbstract
*/
protected static array $columns = [
'l11n_id' => ['name' => 'l11n_id', 'type' => 'int', 'internal' => 'id'],
'l11n_country' => ['name' => 'l11n_country', 'type' => 'string', 'internal' => 'country'],
'l11n_language' => ['name' => 'l11n_language', 'type' => 'string', 'internal' => 'language'],
'l11n_currency' => ['name' => 'l11n_currency', 'type' => 'string', 'internal' => 'currency'],
'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'],