• Resolved einomies

    (@einomies)


    I have strings in my functions.php that are set to my theme’s text domain with __() function but when I sync my .pot file in Loco Translate the plugin doesn’t seem to register the strings from the file. Is there any way I could get them into my .pot?

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

    (@timwhitlock)

    String extraction requires you specify your text domain as a string literal in your code, and your bundle is configured with the correct text domain.

    Are these two things in place? If they are then please post more detail.

    • This reply was modified 7 years, 4 months ago by Tim W.
    • This reply was modified 7 years, 4 months ago by Tim W.
    Thread Starter einomies

    (@einomies)

    My theme is underscores based (http://underscores.me/).
    In my functions.php I have
    load_theme_textdomain('mif', get_template_directory() . '/languages');

    and in functions I do use string literals like $operator = __('Operaattori', 'mif');

    But when I sync the .pot file, no “Operaattori” is found.

    • This reply was modified 7 years, 4 months ago by einomies.
    • This reply was modified 7 years, 4 months ago by einomies.
    Plugin Author Tim W

    (@timwhitlock)

    and your bundle is configured with the correct text domain

    What I meant was that Loco Translate needs to know that the text domain is “mif”. If it hasn’t guessed it automatically, it must be configured. Is this configured?

    See: https://localise.biz/wordpress/plugin/manual#configure

    Thread Starter einomies

    (@einomies)

    Ah, I’m an idiot. The remote server had older version of the functions.php which didn’t have the literals so of course they were missing in loco…

    Bundle was auto configured correctly.

    Sorry for wasting your time! Solved.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Strings form functions.php’ is closed to new replies.