Closed marcosrogers closed 3 years ago
Hey @marcosrogers the code looks great. I'm looking it over and doing some tests. I think I'll try to move all extra files into a "lib" folder to make it easier to copy over to OpenLP during installation.
Great; glad to help!
I had originally tried putting the extra files in a "src" folder, but it didn't work. I couldn't figure out why the files in the jquery.i18n directory are served, but when I tried putting the .js and .json files in the src folder, they wouldn't load.
I just did further tests, and it appears that the OpenLP http server won't serve files in a subfolder of the stage view, but it will serve files in a subfolder two levels down, i.e. it won't serve stages/stream/libs/i18n.js but it will serve stages/stream/libs/js/i18n.js. I haven't looked at the OpenLP code itself closely enough to know why that is.
Here's how I tested it, by placing a .js file in libs/ and then in libs/i18n/
When loading http://0.0.0.0:4316/stage/stream/libs/i18n.js, I get the message "Sorry, an error occurred" in the browser. In the debug output, I get:
2021-06-22 20:45:50,497 openlp.plugins.remotes.lib.httprouter DEBUG Route "^/(stage)/(.*)$" matched "/stage/stream/libs/i18n.js"
2021-06-22 20:45:50,498 openlp.plugins.remotes.lib.httprouter DEBUG serve file request stream/libs/i18n.js
2021-06-22 20:45:50,498 openlp.plugins.remotes.lib.httprouter ERROR Failed to open /home/marcos/.local/share/openlp/stages/libs/i18n.js
And when I load http://0.0.0.0:4316/stage/stream/libs/i18n/i18n.js, it loads the file.
I'll submit a pull request soon. Hope this helps!
This update adds support for translating the interface using Wikimedia's jquery-i18n package. I've added this package and its dependency (CLDRPluralRuleParser) using git subtree so that the code can be updated from upstream relatively easily but also be included by default when the code is downloaded.
To update these libraries to the most recent versions, do the following from the base directory:
To add a translation, copy the qqq.json file to, e.g., fr.json and update the strings. Then add a reference to it in the i18n.js file.
This update also changes some
span
elements tolabel
elements and changes the control.html file back to using only Unix-style line endings (LF) rather than Windows-style, as per the rest of the project.This code builds on the updates in PR #12.