• Resolved benjaminmfm

    (@benjaminmfm)


    Hello,

    I’m trying to use your plugin Loco Translate on my website to translate my theme.
    When I want a string to be translatable, I’m using this :
    <?php echo __('Hello'); ?>
    My problem is that when I try to translate my theme with Loco Translate 2.0.10, the pluggin only scans my “template name” strings and nothing else…
    All these lines are translatable :

    /*
    Template Name: Categories
    */

    Here is my XML config :

    <?xml version="1.0" encoding="utf-8"?>
    <bundle>
      <domain name="bpo">
        <project>
          <source>
            <directory base="WP_CONTENT_DIR">themes/morasel-child/</directory>
          </source>
          <target>
            <directory base="WP_CONTENT_DIR">themes/morasel-child/languages/</directory>
          </target>
        </project>
      </domain>
    </bundle>

    What do I miss ?

    Could you help me plz ?

    Thanks

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Tim W

    (@timwhitlock)

    You must specify this:

    <?php echo __('Hello','bpo'); ?>

    Otherwise the string “Hello” will be in WordPress’s “default” text domain.

    Plugin Author Tim W

    (@timwhitlock)

    On a side note, you don’t need to put full path information into the source and target locations (unless your theme is trying to target another theme). For relative paths you can just use “.” for source and “languages” for target. This makes your config more portable (i.e. if theme directory name was changed)

    Thread Starter benjaminmfm

    (@benjaminmfm)

    Thanks this seems to work !

    You should add this in the documentation… I’m probably the only one having the problem :'(

    Have a nice day ??

    Plugin Author Tim W

    (@timwhitlock)

    I doubt you’re the only one.

    I deliberately avoid replicating WordPress’s own documentation. There’s too much to cover.

    Thanks for the update. I’m marking as resolved.

    Thread Starter benjaminmfm

    (@benjaminmfm)

    I Understand ??

    Thanks again.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Translating only Template Name’ is closed to new replies.