mirror of
https://github.com/miniflux/v2.git
synced 2025-08-06 17:41:00 +00:00
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. |
||
---|---|---|
.. | ||
translations | ||
catalog.go | ||
catalog_test.go | ||
error.go | ||
error_test.go | ||
locale.go | ||
locale_test.go | ||
plural.go | ||
plural_test.go | ||
printer.go | ||
printer_test.go |