Open ahofman opened 2 years ago
Hi there, I'm using a set of JSON files with localised strings, for example:
localization.json localization.nl.json
Where localization.json is the fallback locale (en-US) and localization.nl.json is Dutch.
localization.json
localization.nl.json
When the request locale is nl a CultureNotFoundException is thrown with the message
nl
CultureNotFoundException
Culture is not supported. (Parameter 'name') localization is an invalid culture identifier.
from here: https://github.com/AlexTeixeira/Askmethat-Aspnet-JsonLocalizer/blob/788d32b2318121e9a2a1d41bed62388b3da8db0b/Askmethat.Aspnet.JsonLocalizer.Shared/Localizer/Modes/LocalizationI18NModeGenerator.cs#L49
The issue is that the default localization.json file is being treated as a locale file, and the string.split()[^2] resolves to localization, which it then tries to create a CultureInfo from, which is invalid.
string.split()[^2]
localization
CultureInfo
Hi there, I'm using a set of JSON files with localised strings, for example:
Where
localization.json
is the fallback locale (en-US) andlocalization.nl.json
is Dutch.When the request locale is
nl
aCultureNotFoundException
is thrown with the messagefrom here: https://github.com/AlexTeixeira/Askmethat-Aspnet-JsonLocalizer/blob/788d32b2318121e9a2a1d41bed62388b3da8db0b/Askmethat.Aspnet.JsonLocalizer.Shared/Localizer/Modes/LocalizationI18NModeGenerator.cs#L49
The issue is that the default
localization.json
file is being treated as a locale file, and thestring.split()[^2]
resolves tolocalization
, which it then tries to create aCultureInfo
from, which is invalid.