aboutsummaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorJeroen van Rijn <Kelimion@users.noreply.github.com>2024-05-17 12:15:40 +0200
committerGitHub <noreply@github.com>2024-05-17 12:15:40 +0200
commitb51eb53d041d55da908e2d079abdf5961345a6ab (patch)
tree46183c0affaad88f3d90fce6c133fe67e2d55603 /core
parentab8e3db7e9db742061858ac907dcb19d212b1646 (diff)
parent5a76b3c7c5175908bdce9f087c00287118800234 (diff)
Merge pull request #3595 from Kelimion/i18n-fix
Fix .mo parser: Number of plurals
Diffstat (limited to 'core')
-rw-r--r--core/text/i18n/gettext.odin6
1 files changed, 3 insertions, 3 deletions
diff --git a/core/text/i18n/gettext.odin b/core/text/i18n/gettext.odin
index d5537a19c..6b8f52861 100644
--- a/core/text/i18n/gettext.odin
+++ b/core/text/i18n/gettext.odin
@@ -93,15 +93,15 @@ parse_mo_from_bytes :: proc(data: []byte, options := DEFAULT_PARSE_OPTIONS, plur
keys := bytes.split(key, zero)
vals := bytes.split(val, zero)
-
- if len(keys) != len(vals) || max(len(keys), len(vals)) > MAX_PLURALS {
+
+ if (len(keys) != 1 && len(keys) != 2) || len(vals) > MAX_PLURALS {
return translation, .MO_File_Incorrect_Plural_Count
}
for k in keys {
interned_key, _ := strings.intern_get(&translation.intern, string(k))
- interned_vals := make([]string, len(keys))
+ interned_vals := make([]string, len(vals))
last_val: string
i := 0