1

I'm building a theme which includes a separate "section" and I want to make both the theme and the separate section localizable. However, I don't want to have them under the same textdomain.

Would someone advise against doing this? Could there be any issues?

I don't want to have the separate section as a plugin.

This is what could appear inside e.g. functions.php:

__('String', 'themename');
__('Another string', 'somethingelse');
1
  • hmm... have you tried that? does it work? what have you done to call multilple translation files meaning with this line (for example): load_theme_textdomain('sagive', $lang);
    – Sagive
    Commented Mar 31, 2012 at 20:21

1 Answer 1

1

Technically, this is possible. You can load as many language files as you want:

load_theme_textdomain( 'text_domain_1', get_template_directory() . '/languages/td1' ) );
load_theme_textdomain( 'text_domain_2', get_template_directory() . '/languages/td2' ) );

In terms of performance it may be useful if want to separate front-end and back-end translations.

But it is the wrong solution if do this to manage plugin code that you have moved into a theme. For example the notorious contact form, shortcodes or a dashboard widget – these parts should be handled by real plugins.

TL;DR: It depends on the problem you want to solve.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.