mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-05-10 21:22:53 +00:00
LibUnicode: Move Locale enumeration from generated UCD data to CLDR data
The UCD set of data contained a very small subset of all locales just to handle some special casing rules. This enumeration will be needed within the CLDR generator as well. So rather than duplicate the enum, remove it from the UCD generator in favor of the full list of locales known by the CLDR generator.
This commit is contained in:
parent
317f55bb25
commit
b8ad4d302e
Notes:
sideshowbarker
2024-07-18 05:14:07 +09:00
Author: https://github.com/trflynn89
Commit: b8ad4d302e
Pull-request: https://github.com/SerenityOS/serenity/pull/9622
Reviewed-by: https://github.com/linusg
3 changed files with 26 additions and 14 deletions
|
@ -91,7 +91,6 @@ struct UnicodeData {
|
|||
Vector<SpecialCasing> special_casing;
|
||||
u32 largest_casing_transform_size { 0 };
|
||||
u32 largest_special_casing_size { 0 };
|
||||
Vector<String> locales;
|
||||
Vector<String> conditions;
|
||||
|
||||
Vector<CodePointData> code_point_data;
|
||||
|
@ -200,11 +199,10 @@ static void parse_special_casing(Core::File& file, UnicodeData& unicode_data)
|
|||
casing.condition = move(conditions[0]);
|
||||
}
|
||||
|
||||
casing.locale = casing.locale.to_uppercase();
|
||||
if (!casing.locale.is_empty())
|
||||
casing.locale = String::formatted("{:c}{}", to_ascii_uppercase(casing.locale[0]), casing.locale.substring_view(1));
|
||||
casing.condition.replace("_", "", true);
|
||||
|
||||
if (!casing.locale.is_empty() && !unicode_data.locales.contains_slow(casing.locale))
|
||||
unicode_data.locales.append(casing.locale);
|
||||
if (!casing.condition.is_empty() && !unicode_data.conditions.contains_slow(casing.condition))
|
||||
unicode_data.conditions.append(casing.condition);
|
||||
}
|
||||
|
@ -487,11 +485,11 @@ enum class @name@ : @underlying@ {)~~~");
|
|||
#include <AK/Optional.h>
|
||||
#include <AK/Types.h>
|
||||
#include <LibUnicode/Forward.h>
|
||||
#include <LibUnicode/UnicodeLocale.h>
|
||||
|
||||
namespace Unicode {
|
||||
)~~~");
|
||||
|
||||
generate_enum("Locale"sv, "None"sv, move(unicode_data.locales));
|
||||
generate_enum("Condition"sv, "None"sv, move(unicode_data.conditions));
|
||||
generate_enum("GeneralCategory"sv, {}, unicode_data.general_categories.keys(), unicode_data.general_category_aliases);
|
||||
generate_enum("Property"sv, {}, unicode_data.prop_list.keys(), unicode_data.prop_aliases);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue