From be67089b745f6212fe78d047cbca937ab19987fe Mon Sep 17 00:00:00 2001 From: Joshua Ramon Enslin Date: Wed, 14 Dec 2022 16:11:49 +0100 Subject: [PATCH] Add translations for color set; options for getting unsorted color, gender lists --- l18n | 2 +- src/MDColorsSet.php | 43 +++++++++++++++++++++++++++++++++++++++++ src/MDGenderSet.php | 14 +++++++++++++- src/MDObjectFormSet.php | 12 ++++++++++++ 4 files changed, 69 insertions(+), 2 deletions(-) diff --git a/l18n b/l18n index 5b72321..6d624ef 160000 --- a/l18n +++ b/l18n @@ -1 +1 @@ -Subproject commit 5b72321de74d443356d1a0d5fb7b49927267a309 +Subproject commit 6d624efcd90438922b732225772582704b2bd2ed diff --git a/src/MDColorsSet.php b/src/MDColorsSet.php index 6c13e5c..bef4d7b 100644 --- a/src/MDColorsSet.php +++ b/src/MDColorsSet.php @@ -30,6 +30,26 @@ final class MDColorsSet extends MDValueSet { "aqua", ]; + const COLOR_NAMES_AND_EMPTY = [ + '', + "black", + "green", + "silver", + "lime", + "gray", + "olive", + "white", + "yellow", + "maroon", + "navy", + "red", + "blue", + "purple", + "teal", + "fuchsia", + "aqua", + ]; + const COLORS_RGB = [ "black" => [0, 0, 0], "green" => [0, 128, 0], @@ -49,4 +69,27 @@ final class MDColorsSet extends MDValueSet { "aqua" => [0, 255, 255], ]; + /** + * Gets an unsorted list of the entries in a translated version. + * + * @param MDTlLoader $tlLoader Translation loader. + * + * @return array + */ + public static function getUnsortedList(MDTlLoader $tlLoader):array { + return parent::getTlUnsortedList($tlLoader, self::GENDERS, "gender_set", "gender_set"); + + } + + /** + * Gets a list of the entries in a translated version. + * + * @param MDTlLoader $tlLoader Translation loader. + * + * @return array + */ + public static function getSortedList(MDTlLoader $tlLoader):array { + return parent::getTlSortedList($tlLoader, self::COLOR_NAMES, "colors_set", "colors_set"); + + } } diff --git a/src/MDGenderSet.php b/src/MDGenderSet.php index 01f4e5e..a5a2604 100644 --- a/src/MDGenderSet.php +++ b/src/MDGenderSet.php @@ -15,9 +15,21 @@ final class MDGenderSet extends MDValueSet { '', 'female', 'male', - 'gender', + 'other', ]; + /** + * Gets an unsorted list of the entries in a translated version. + * + * @param MDTlLoader $tlLoader Translation loader. + * + * @return array + */ + public static function getUnsortedList(MDTlLoader $tlLoader):array { + return parent::getTlUnsortedList($tlLoader, self::GENDERS, "gender_set", "gender_set"); + + } + /** * Gets a sorted list of the entries in a translated version. * diff --git a/src/MDObjectFormSet.php b/src/MDObjectFormSet.php index b261540..c35b600 100644 --- a/src/MDObjectFormSet.php +++ b/src/MDObjectFormSet.php @@ -20,6 +20,18 @@ final class MDObjectFormSet extends MDValueSet { 'cylinder', ]; + /** + * Gets an unsorted list of the entries in a translated version. + * + * @param MDTlLoader $tlLoader Translation loader. + * + * @return array + */ + public static function getUnsortedList(MDTlLoader $tlLoader):array { + return parent::getTlUnsortedList($tlLoader, self::FORMS, "object_form_set", "object_form_set"); + + } + /** * Gets a sorted list of the entries in a translated version. *