Skip to content
This repository has been archived by the owner on Jan 30, 2023. It is now read-only.

Translation refactoring #1254

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open

Conversation

simonschaufi
Copy link
Contributor

Refactor translation loading in order to make it possible to load language files from additional packages as well.

Reason for this pull request:

  • Customer modifications of kimai

@simonschaufi simonschaufi added this to the 1.4 milestone Sep 14, 2018
@simonschaufi simonschaufi force-pushed the translation-refactoring branch 2 times, most recently from a7eb030 to 5139269 Compare September 14, 2018 14:19
@simonschaufi simonschaufi force-pushed the translation-refactoring branch from 5139269 to 796fbeb Compare September 14, 2018 14:19
*/
public function load()
{
$language = Kimai_Registry::getConfig()->getLanguage();
Copy link
Member

@kevinpapst kevinpapst Sep 14, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To be honest, I think this is a breach of the responsibility principle.
From an architectural point of view the translation service should neither know nor care about a global registry.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

any better idea? the way how it was before is definitely not better.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm loading my own translations with that:

$this->translationData = Kimai_Registry::getTranslation();
$this->translationData->addTranslations('en', __DIR__ . '/');
$this->translationData->addTranslations('de', __DIR__ . '/');
Kimai_Registry::setTranslation($this->translationData);

if you have a better idea, I'm open for feedback ;)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, you are doing it like it was done before, but you find the way before not better?
Makes not much sense to me 😈
Yes my proposal stands: leave as it was before. There is absolutely no reason why the translation service should know about the registry. Only the registry is global and knows about all objects it handles.
Don't be offended - but I don't really care about Kimai 1. The code is crap and won't get better by any refactoring. If you like to move stuff around: do so!

@kevinpapst
Copy link
Member

working on a paid extension?

@simonschaufi
Copy link
Contributor Author

simonschaufi commented Sep 14, 2018

working on a paid extension?

jup. new admin configuration section which I provide as composer package with minimal adjustments to kimai core. That's why I want to load my own translation files instead of patching kimai core.

@kevinpapst
Copy link
Member

Good idea to prepare the core to supply all necessary functions you need.
But what you wanted to achieve was possible before, wasn't it?

@kevinpapst kevinpapst removed their assignment Jun 20, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants