1
0
Fork 0
mirror of https://github.com/miniflux/v2.git synced 2025-08-06 17:41:00 +00:00
miniflux-v2/internal/locale
Julien Voisin 181e1341e1
refactor(locale): introspect the translation files at load time
Since Go doesn't support unions, and because the translation format is a bit
wacky with the same field having multiple types, we must resort to
introspection to switch between single-item translation (for singular), and
multi-items ones (for plurals).

Previously, introspection was done at runtime, which is not only slow, but will
also only catch typing errors while trying to use the translations. The current
approach is to use a struct with a different field per possible type, and
implement a custom unmarshaller to dispatch the translations to the right one.
This should marginally reduce the memory consumption since interface-boxing
doesn't happen anymore, speed up the translations matching, and enforce proper
typing earlier. This also allows us to remove a bunch of now-useless tests.
2025-07-31 19:10:14 -07:00
..
translations fix(integration): rename Linkwarden endpoint label to base URL (#3568) 2025-07-22 20:49:54 -07:00
catalog.go refactor(locale): introspect the translation files at load time 2025-07-31 19:10:14 -07:00
catalog_test.go refactor(locale): introspect the translation files at load time 2025-07-31 19:10:14 -07:00
error.go Refactor HTTP Client and LocalizedError packages 2023-10-22 13:09:30 -07:00
error_test.go refactor(locale): introspect the translation files at load time 2025-07-31 19:10:14 -07:00
locale.go feat(locale): add Romanian translation 2025-03-28 11:11:20 -07:00
locale_test.go refactor(locale): delay parsing of translations until they're used 2024-12-09 17:05:14 -08:00
plural.go refactor(locale): simplify pluralForm 2025-07-07 15:30:41 -07:00
plural_test.go test(locale): increase test coverage to 100% 2025-07-07 17:39:56 -07:00
printer.go refactor(locale): introspect the translation files at load time 2025-07-31 19:10:14 -07:00
printer_test.go refactor(locale): introspect the translation files at load time 2025-07-31 19:10:14 -07:00