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
Autoload app's js translations #13350
Conversation
@Raydiation are you talking about OC.addTranslations() from JS or from PHP ? |
@PVince81 since we add script paths ownCloud will break if these scripts are not present. So we should check if they exist |
|
@DeepDiver1975 do we agree on this new approach ? |
@Raydiation thanks. I'll update the docs. |
Fixes #12490 |
Fix for calendar is here owncloud/calendar#671 |
Refer to this link for build results (access rights to CI server needed): |
tested 👍 |
sweet shit - thx |
It worked for me too, so 👍 |
I'd feel even more confident to merge this if another person could check/test this, @MorrisJobke ? |
Works here too 👍 |
Autoload app's js translations
The inspection completed: 8 new issues, 1 updated code elements |
As discussed on IRC this tries to automatically load js translations for all apps (that is if your app calls OC_Util::addScript('appName', 'file') and not OC_Util::addScript('madnessmagic').
This currently breaks calendar because they exploit a bug in the method to do weird shit like
instead of
We can patch this easily though
PS: this also loads translations for apps that register their scripts in app.php which is an antipattern.
@PVince81 your addTranslations method seems broken. It does not seem to add any translations at all unless i add translation('news') to my index.php. Then all translations are added properly. We also should handle non existent translations so that the page does not break if the translation is not present. You need to add a check for this in your addTranslations method and fall back to english if no file is found
@georgehrke @raghunayyar @MorrisJobke @DeepDiver1975
Fixes #12490