Ask A Question

Marry localize.js with pre-path-domain structure (/en/) and limit where to look for phrases?

Hello! I am on a wordpress setup with localize.js up and running. I plan on mixing hardcoded translations with localize.js automated translations and get rid of the javascript-language-switcher. Therefore I need to know: 1a) A way to manage a domain structure like this in wordpress: (default is German without a pre-path) 1b) A way to translate slugs in wordpress My domain structure looks like this<category> archive.php for categories<category>/<subcategory> archive.php also filtering subcategories<post-title-slug> single.php for posts page.php for pages 2) How to let localizejs only run when /en/ is set 3a) How to limit where localizejs looks for phrases. 3b) .. and translate <title> and <meta>-tags 4) "autopublish" (and therefore translate) these phrases with machine translating, but still be able to do human translation in the dashboard (or order a translation) The idea with 3) and 4) is that the editor generally doesn't have to use the localize dashboard, only when needed– ––––––– My plan on solivng these issues: 1a) Use qTranslate X plugin and tell the editors to use it just for the taxonomies etc. and ignore post title and post content 1b) Use qTranslate X slug-translation; but .. I read about several issues with this Open for suggestions on 1) 2) With php echo the Localize.initialize({ ... }) script-part only when /en/ is in the url. But I somewhat fear this interferes with how localizejs does things. Defenitely need your thoughts on this one. 3) Let localize js only look in containers with the class .localizejs <div class="content localizejs">...</div> Didn't found a way to do this in frontend API, though 4) No idea, please help :) I wonder if localize is the right tool for this approach and would love to hear your opinions on this, plus suggestions on how to solve these issues. Thank you!

Posted by René Eschke 3 years ago