[IDEA] How to do better on localization? #1832
michaelkubina
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Apologies to the long text upfront...but we need to talk a little about architecture here...
Translations/Localizations in Kitodo.Presentation are currently in a quite scattered state and localization management is undocumented.
We have several problems with the way it is now:
translate()helper function is actually a performance hog (lazy loading a single entry at once, multiple sql queries per entry, etc), which is why we will provide a bugfix for it in the coming days...so this will not be a problem anymoreWe would like to reduce complexity and have a straight forward localization workflow for Kitodo.Presentation. But this requires some changes:
Purpose of translation files?
We need to make clear, what purpose translation files serve:
static translationsused everywhere and utilizing the language files here is the way to go.dynamic translationswe are handling. Translating these records in the view should not be handled by translation files but by other means.This means, we cannot use translation files user generated content in our templates.
How to use translations?
site_languages,New Tenantusage,page translationsof storage folder and pages (also those with plugins),language comparisonand the usage of the wizard to achieveconnected mode,creating new recordsand translating them in the repositoriesHow to make translation handling ubiquitous in code?
Currently we outsource business logic (specifically the handling of
dynamic translations) into the templates - except where we dont, because we saw it as being required in the controller. So we are handling translations in two ways already.... Core isse: Invoking fluids translation viewhelper cannot translate dynamic content. So we do need to adress this either by or in combination with:translate()helper method, at the cost of overhead and business logic being still present in the views. This should be easy to achieve.dynamic translationsdirectly in the controller and sending the output to the view (as its done in a few places). Business logic would be where it should be, less overhead (viewhelper invocations). this was done in the table of contents controller, and this was actually the right way. only the helper method was not optimized for this taskHelperclass into a dedicated translation service, that could be injected into the controllers. This would debloat the helper class and be a modern approachWhich way do we choose?
dynamic translationsproperly, where language files are used now?dynamic translationsfrom the view -> templates simply output the pre-translated text?With where things are going, we need to have a robust architecture in place. Currently we are already struggeling with those few translations we are handling. We will likely need more once we translate licences, access policies to resources, restrictions, call to actions, etc....
Beta Was this translation helpful? Give feedback.
All reactions