my17560 / dokuwiki-template-readthedokus

"Read the Docs" flavored DokuWiki template
MIT License
14 stars 11 forks source link

Make "Search docs" localizable #16

Closed ivmirx closed 2 years ago

ivmirx commented 2 years ago

First of all, thanks a lot for making the cleanest DokuWiki template! It saved me a lot of headache for a mobile-first site.

I'm using it for a non-English project and while the administration parts can stay in English, I wish there was some way to change "Search docs" in https://github.com/my17560/dokuwiki-template-readthedokus/blob/1bff756b542066826c09f3eac02839502477d376/js/readthedokus.js#L77 …aside from editing the .js file directly.

I wish I could just make a pull request, but I'm quite weak in web development to understand how to pull translation data from PHP to a JS script without increasing page loading time.

Also it would be great if you can provide a Ko-Fi or PayPal for donations on the plugin page. Thank you for your work!

UPD: another texts I've found are "Previous", "Next" in the page footer and "Docs" and "Edit this page" in its header – I can edit these templates directly but I think it will not work for multilingual wikis.

my17560 commented 2 years ago

Hi, I'm glad to hear the theme saved your headache. I've updated the theme on GitHub, not the DokuWiki template site yet, so press "Re-install" in Extension Manager.

You need to prepare your language file called "lang.php". Please reference English lang.php in "lib/tpl/readthedokus/lang/en/lang.php" and you need only the last 6 lines for non-admin pages.

Place the lang.php in either: lib/tpl/readthedokus/lang/(your language ISO code)/ or conf/template_lang/readthedokus/(your language ISO code)/

If you would like me to add your lang.php to my theme, please give me your file and I'll gladly add it to my theme.

Note: Whenever you update the lang.php, update lib/tpl/readthedokus/script.js also (just save without editing) or translations will not be applied. Exactly speaking, you need to do so only when you edit $lang['js']['searchform_placeholder'] line.

Setting $lang['js']['searchform_placeholder'] to blank will show DokuWiki's original placeholder.

Thanks for your donation offer. I'll add a link on GitHub.

ivmirx commented 2 years ago

Many thanks! I added Spanish and Russian localizations to my todo-list and will make a PR later.

my17560 commented 2 years ago

Hi, I'm closing this issue for now. Please re-open or throw a new issue anytime if you want!