Community Forum

Ask a Question
Back to All

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

(edited)

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:
http://domain.com/uebersetzter-beitrag-slug (default is German without a pre-path)
http://domain.com/en/translated-post-slug

1b) A way to translate slugs in wordpress
My domain structure looks like this
http://domain.com/<category> archive.php for categories
http://domain.com/<category>/<subcategory> archive.php also filtering subcategories
http://domain.com/<post-title-slug> single.php for posts
http://domain.com/kontakt page.php for pages
http://domain.com/?s=search-term

  1. How to let localizejs only run when /en/ is set

3a) How to limit where localizejs looks for phrases.

3b) .. and translate and -tags

  1. "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)

  1. 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.

  2. Let localize js only look in containers with the class .localizejs

    ...
    Didn't found a way to do this in frontend API, though
  3. 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!