Make units for lengths and weights translatable
This commit is contained in:
@ -9,9 +9,33 @@ declare(strict_types = 1);
|
||||
/**
|
||||
* Class containing available units for weights, lengths etc.
|
||||
*/
|
||||
class MDUnitsSet {
|
||||
class MDUnitsSet extends MDValueSet {
|
||||
|
||||
const UNITS_LENGTH = ['', 'm', 'dm', 'cm', 'mm'];
|
||||
const UNITS_WEIGHT = ['', 't', 'kg', 'g'];
|
||||
|
||||
/**
|
||||
* Returns a translated list of length units.
|
||||
*
|
||||
* @param MDTlLoader $tlLoader Translation loader.
|
||||
*
|
||||
* @return array<string>
|
||||
*/
|
||||
function getLengthUnitsTLed(MDTlLoader $tlLoader):array {
|
||||
return parent::getTlUnsortedList($tlLoader, self::UNITS_LENGTH, "units_length_set", "units_length_set");
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a translated list of weight units.
|
||||
*
|
||||
* @param MDTlLoader $tlLoader Translation loader.
|
||||
*
|
||||
* @return array<string>
|
||||
*/
|
||||
function getWeightUnitsTLed(MDTlLoader $tlLoader):array {
|
||||
return parent::getTlUnsortedList($tlLoader, self::UNITS_WEIGHT, "units_weight_set", "units_weight_set");
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user