Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

override mode for extensions? #75

Open
medarob opened this issue Mar 22, 2024 · 3 comments
Open

override mode for extensions? #75

medarob opened this issue Mar 22, 2024 · 3 comments

Comments

@medarob
Copy link
Contributor

medarob commented Mar 22, 2024

Maybe I missed something but there is the following scenario:

I want to override the labels of another extension, for example ext:news.

As described here https://docs.typo3.org/m/typo3/reference-coreapi/11.5/en-us/ApiOverview/Localization/ManagingTranslations.html#xliff-translating-custom in EXT:my_ext/ext_localconf.php I have the following entry:
$GLOBALS['TYPO3_CONF_VARS']['SYS']['locallangXMLOverride']['EXT:news/Resources/Private/Language/locallang.xlf'][0] = 'EXT:my_ext/Resources/Private/Language/Overrides/News/Resources/Private/Language/locallang.xlf';

The new file de.locallang.xlf (located in the same folder EXT:my_ext/Resources/Private/Language/Overrides/News/Resources/Private/Language/) has the following content:

		<body>
			<trans-unit id="dateFormat" resname="dateFormat">
				<source>%d/%m/%Y</source>
				<target>%d.%m.%Y</target>
			</trans-unit>
			<trans-unit id="related-files" resname="related-files">
				<source>More downloads</source>
				<target>Weitere Downloads</target>
			</trans-unit>
		</body>

So, just the text for two keys have been changed.
But, when I open the translation files from the news extension in the locallang extension, I get only the original english text without the German translation.

grafik

grafik

grafik

What do I have to change so that the extension will pick up the Overrides folder from my extension with the current changes?

Changes should also be written in the EXT:my_ext/Resources/Private/Language/Overrides/News/Resources/Private/Language/ folder.

Currently, even if I select "my_ext" in the dropdown I will only see *.xlf files located directly in the folder EXT:my_ext/Resources/Private/Language/. No subfolders are taken into account.

I think there needs to be another override mode to be implemented?

Currently the user only has the option to

  • edit the extension language files directly (which is ok for your own extension but not for 3rd party extensions)
  • override in the label / l10 folders which is ok if you don't use crowdin because that would override the own changes again - because TYPO3 translations rely on the crowdin translations, that approach seems to be not the right one...
@h-e-l-l-o-w-o-r-l-d
Copy link

h-e-l-l-o-w-o-r-l-d commented Mar 25, 2024

Currently, even if I select "my_ext" in the dropdown I will only see *.xlf files located directly in the folder EXT:my_ext/Resources/Private/Language/. No subfolders are taken into account.

It seems that only up to 3 subfolders are considered and fetched. While theoretically this is okay, the recommended (and sometimes needed) way is to create all subfolders to make it work with other extensions. See last paragraph in https://docs.typo3.org/p/lochmueller/autoloader/7.2/en-us/Loader/LanguageOverride.html

Conclusion: The restriction of possible subfolders should be dropped or is there something we are missing?

@rrrapha
Copy link
Owner

rrrapha commented Mar 26, 2024

Thank you @medarob for your input.
Indeed, the overriding of labels is currently not directly supported. I plan to remove the useL10n mode and try to better support the overriding mechanism in the future.
(As described here: https://docs.typo3.org/m/typo3/reference-coreapi/12.4/en-us/ApiOverview/Localization/ManagingTranslations.html#xliff-translating-custom).

@medarob
Copy link
Contributor Author

medarob commented Mar 26, 2024

Thank you for your answer.

With the currently merged change it's for now possible to show those manually created files in the EXT:my_ext/Resources/Private/Language/Overrides/News/Resources/Private/Language/ folder.

Another idea for that issue which just came to my mind:
Not sure if that is too much but how about an option where you can set the folder depth with TypoScript?

Anyways, it would be good if the user could override existing language files from 3rd party extension. So, in an "override"-mode a subfolder structure will be created in the Overrides folder.

It would be good if this path for the Overrides folder is configurable? Then, if the path is located in an extension, a new entry in ext_localconf.php will be automatically created (so you don't have to manually create it). If the path for the Overrides is not located in the extension, then new entries will be added to the AdditionalConfigration.php.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants