GanttEx ships with Gettext translations for:
| Locale | Language |
|---|---|
en | English |
es | Spanish |
fr | French |
it | Italian |
de | German |
pt | Portuguese |
pt_BR | Brazilian Portuguese |
ja | Japanese |
Choose it per chart; names such as "pt-BR" or "es-CL" are normalized:
<.live_component module={GanttEx.Live.Gantt} id="gantt" tasks={@tasks} links={@links} locale={@locale} />The translations live in their own backend (GanttEx.Gettext), so they
never mix with your application's messages.
Date patterns
Date formats are translated too, so each language orders dates its own way
(03/07/2025 in English, 07/03/2025 in Spanish, 07.03.2025 in German,
2025/03/07 in Japanese):
GanttEx.I18n.format(~N[2025-03-07 00:00:00], :month_year, "ja")
#=> "2025年3月"The named patterns are :date, :datetime, :time, :day,
:weekday_day, :day_month, :weekday_date, :month_year, :month,
:year and :quarter.
Adding or fixing a language
- Add the locale to
@localesinGanttEx.I18n. - Run
mix gettext.merge priv/gettext --locale xx. - Translate
priv/gettext/xx/LC_MESSAGES/default.po, including thedate formatpatterns and the month and weekday names.
test/gantt_ex/i18n_test.exs fails if any message of a bundled locale is
left untranslated.