curiosum-dev / kanta

User-friendly translations manager for Elixir/Phoenix projects.
https://kanta.curiosum.com/kanta/dashboard
MIT License
182 stars 15 forks source link

Fix arabic plurals bug #90

Closed peaceful-james closed 2 weeks ago

peaceful-james commented 1 month ago

Before this change:

image

Clicking "Form 6" would result in this error:

[error] GenServer #PID<0.1773.0> terminating
** (KeyError) key 5 not found in: %{
  0 => [0],
  1 => [1],
  2 => [2],
  3 => [3, 4, 5, 6, 7, 8, 9, 10],
  4 => [11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28,
   29, 30]
}
    (erts 15.0.1) :erlang.map_get(5, %{0 => [0], 1 => [1], 2 => [2], 3 => [3, 4, 5, 6, 7, 8, 9, 10], 4 => [11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30]})
    (kanta 0.3.1) lib/kanta_web/live/translations/translation_form_live/components/plural_translation_form/plural_translation_form.ex:76: KantaWeb.Translations.PluralTranslationForm.plural_examples/2
    (kanta 0.3.1) lib/kanta_web/live/translations/translation_form_live/components/plural_translation_form/plural_translation_form.html.heex:46: anonymous fn/2 in KantaWeb.Translations.PluralTranslationForm.render/1

It appears that Arabic has a lot of plural variations. Increasing the plural example count from 30 to 100 fixes this problem.

peaceful-james commented 2 weeks ago

@vi0dine Please let me know if this needs any extra stuff.