Find proper “text domain” within theme

I have a client with a wordpress theme, Nevada, and we are having trouble making the built in translations work for it. The theme contains .mo files for English, German, and Slovenian, and appear to be found by our WPML plugin. However, they are not translating any of the template text inside the theme. Translations of content we have created is working fine.

Following the instructions here: http://wpml.org/documentation/getting-started-guide/theme-localization/ , looking at section “Option 2: Using a .mo file for theme localization”, it sounds like all I need to do is enter the textdomain for the theme.

Read More

Problem is, I don’t know what it is, or how to find it. I tried digging through the theme files themselves but any text output is abstracted away behind many many layers of functions. To make matters worse, neither I or my client have a support account with the theme providers (but we do have a valid license!) and they are not being helpful at all.

How can I find the text domain to make WPML work with this theme?

Update

When I open one of the .po files I see lines like:

#: template-part-teaser.php:41
#@ Nevada
msgid "404 Error"
msgstr "404 Error"

So I tried entering “Nevada” as the textdomain in the WPML plugin, but this did not change anything for me

Related posts

2 comments

  1. Within the code, can you see any syntax like either of the following?

    __( 'Hello, dear user!', 'my-text-domain' )
    
    _e( 'Your Ad here', 'my-text-domain' )
    

    That is, strings starting with __ (double underscores) or _e. If so, where the above says my-text-domain, you should find the name of your text domain.

  2. In most cases, @vancoder’s answer is absolutely correct. My situation appears to be fairly unique, but I want to share my experience so it may help someone else.

    In the case of this Nevada theme, the standard functions are not used in the template files. Apparently, Nevada uses the Lambda framework (something totally foreign to me) and so any text output occurs with a lambda_translate function call. After digging and digging, I gave up on trying to trace these functions back to a __() or _e() call.

    Instead, to find the text domain, I put on my Linux hat and entered this command in the Nevada theme folder.

    grep -r "load_theme_textdomain" .
    

    Sure enough, in the functions.php file, the load_theme_textdomain function was there with the text-domain.

Comments are closed.