Language import broken #749
Labels
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: joomla/Component-Builder#749
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Steps to reproduce the issue
Expected result
Language strings updated
Actual result
Installation 1:
1062 Duplicate entry '299' for key 'PRIMARY'
Installation 2:
1062 Duplicate entry '512' for key 'PRIMARY'
System information (as much as possible)
Additional comments
I just set up a local environment with mamp pro and default JCB installation and the import worked fine. When i installed my components package and then did the import of the file again it gave me the same duplicate entry 512 altho i'm importing a different file here.
I'm updating with my conclusion:
When there is an int in the source column the script won't find the record and will try to add it although the record already exists.
NOTE: a language string with just an int gets added when you enable the mailer helper function. a language string with value "25" gets added then.
Here is where it breaks:
d5482d65cb/admin/models/import_language_translations.php (L511)
on the checkString method : ComponentbuilderHelper::checkString($row[$source_key])
When i cast $row[$source_key] to string it works as you'd expect.
A second seperate problem i found is with the language string about DKIM when you add the mailer helper method.
This code doesn't get translated correctly by PHPSpreadsheet in the model where the$data['array'] is created:
d5482d65cb/admin/models/import_language_translations.php (L445)
When i vardump the line of the row that contains the above mentioned language string it only returns this:
About the bad practice JS in the translation string, I can only say 😏
We should remove this, and add a custom field to load the JS, this will be best practice.
As for the number being added, wow I have never had this issue... I will look into that part to see what can be done.
Making the import function more resilient is good, so we can do a little more to catch these kind of edge cases.
Awesome. do you want me to test it without the JS in that string to make sure it works?