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
Add support for non prefixed language files #19353
Add support for non prefixed language files #19353
Conversation
For those wondering how Crowdin integrates GitHub, I have setup a test project for the Weblinks extensions: https://crowdin.com/project/joomla-weblinks-extension The result is https://github.com/Bakual/weblinks/pull/2 which is all done by Crowdin itself automatically. |
This is basically why even when trying to use Crowdin's native CLI functionality I ended up publishing https://github.com/joomla-projects/crowdin-sync instead (making use of the same YAML config file). Through its tooling there just isn't a way to get the files downloaded with the correct name, but with the API you can manipulate the data to build the right file paths. Removing the locale code from the filenames simplifies a lot of things in the long run IMO. |
i guess that the en-GB.ini could be renamed as joomla.ini |
From a code point of view, that actually would make sense as it makes the code simpler. We could get rid of the check |
Am in two minds about this one. Can see how it could ease things at a technical level. At the same time it looks like trouble leaving out the unique identifier for all the people dealing with language maintenance beyond one language. When you work in a role as language coordinator, translation maintainer or the like, there would be a great mix of how your staff or volunteers would prefer to work with the language sets, the tools they use and how they deliver them back for use. Cutting out the file naming identifier could make such maintenance more troublesome. Having a visible file prefix identifier is rather helpful when dealing with multiple languages (2 -> +50) Another concern would be when installing multiple languages with an extension and making use of system wide language folders and also of in extension level language folders, to have different messages in the sys.inis for installation message and for the edit extension main message. Here you could have an install folder with multiple languages that are prefixed in same folder, and this would be a problem should they all lack their unique xx-XX identifier. |
It's not the dot separation. You upload a file as
Not a concern with the design of our language system. It enforces a |
In that case, it should not be limited to en-GB obviously. |
Not sure what you mean. Do you mean it has to be done for the other languages as well? If so, then yes. @ot2sen I understand that it might be harder to differentiate the files, but I think that could be solved by adjusting the workflow slightly. Eg put the files into subdirectories/zips with the proper language code. |
Some thoughts
Side Note:
That is something com_localise does in a few clicks and then make the lang pack also in a few clicks. 😺 |
Actually, I think other translation platforms may face the same issue if they have a GitHub integration.
You could make the com_localise code simpler then as well. 😄 |
Just for history, they already did reside in xx-XX folders in 1.5. |
True, and in 1.0 it was a /language/english.php file. So it was like this since the INI files were introduced. |
All these "problems" are just "what ifs" and should never be an issue when using a robust workflow |
@mbabker I probably wasn´t clear about the
where I meant within the installation package, not where it get installed. Today you can have an installation XML like:
Without the prefix you would have no way to tell which is which of the 3 double sets of files. |
but you also can have just |
@ot2sen Personally, I wouldn't remove the prefixes in J4.0 anyway. So you could still do that in 4.0. If we remove it in 5.0, then that would be no longer possible. |
@Fedik yeah, also did have the language in the example which would have subfolders with the prefixes within in the installation package. Those to go directly language folder inside the extension when installed, which is fine. The other /lang folder would have been more clear in purpose had I added just the sys.inis to demonstrate these are for having a different message for the user on installation finalisation. Anyway, it all comes down to habit of having done year of manual preparation. With automatisation it is not much of an issue ;) @Bakual yep, workflow again. Automate with subfolders and it is not much of an issue. As I said in first post I do see how this can ease thing at the technical level. Dusting off the dinosaur and shaking off my manual habits. At the end of the day I like the suggestion :) |
Honestly, having an opinion on this or making a decision shouldn't be 100% driven by Crowdin. With that said, just shooting from the hip here are how other systems handle filesystem structure. Joomla: So Joomla's really the only system with a double locale code in its filesystem structure. Personally I'm not a fan of it but I see why it has benefits to some. |
Should we not target that pr against 4 and rename the language files correctly without the double locale? |
Since it's completely B/C, it can (and imho should) be merged into 3.9. |
True. |
Is it really totally B/C? I have not tested with overrides. Has anybody done it? In overrides, the files are NOT separated by folders. |
Considering the code loading and parsing overrides if found hasn't changed, then no, the overrides aren't broken (in part because it doesn't even use this same load method but bypasses it completely and goes straight to parse). |
I actually tested overrides and they still work as expected. It's even mentioned as test case in the PR 😉 |
Indeed, as the code concerning loading overrides ini has not changed, these are still working as are. Suggestion: if we go this way then we may also create an array (on the model of localise.php) for Some more remarks:
---ADDED: Or check the existence of the file as done below for Add this to the PR? What would be the name in the future for en-GB.xml in the language packs? joomla.xml is already used as manifest. |
Should we target the pr against 3.9? |
42f6d59
to
769a1de
Compare
Thanks for this! |
This has been documented here: https://docs.joomla.org/J3.x:Joomla_3.10_Backports |
When I tried to use the GitHub integration of Crowdin, I faced the issue that Crowdin can't rename part of the translated filename. Eg it can't rename the source file
en-GB.com_weblinks.ini
tode-DE.com_weblinks.ini
. It can however change the foldername easily, eg/language/en-GB/
can be changed to/language/de-DE/
.That made me question the need for the language prefix.
Since we already have the language specific in the folderstructure, there is no technical reason to add it also to the filename.
Summary of Changes
This PR changes the JLanguage logic so it first tries to load the file with prefix and if that fails it tries again with a non-prefixed filename.
This works for all files except the
en-GB.ini
(.ini
doesn't make much sense) one and the ones in the override folder (we need the prefix here to differentiate the files).This PR also removes some fallback code that tries to load the file from the default (en-GB) language. However since a few years we already do the same thing before even trying to load the real file. So those fallback strings are already loaded and that code did just load the same strings again.
Testing Instructions
Expected result
With this PR, everything should work as before, even when renaming the files.
Actual result
Without this PR you get the english fallback strings when you rename a file.
Points for Discussion
Personally I would certainly keep it for 4.0 but it may be something to be removed for 5.0 but I don't think it's worth the trouble. The code to keep it both ways is quite simple.
Documentation Changes Required
Documentation regarding translations need to be adjusted.