Localization of a wordpress theme without a textdomain

Localization of a wordpress theme without a textdomain

I have a wordpress theme without textdomain (i.e. e(x) and not e(x,domain)). I also have the .po and .mo files in a folder under /themes/My Theme/localization (Notice the space name in the my theme). I would like to activate fr_FR. I created fr_FR.po and .mo and changed the wp-config to add the locale for fr_FR. However, I am still not getting the french to work. I saw many sites telling you to add a load_theme_textdomain at the top of functions.php, but I do not know what would my textdomain be. Any help will be appreciated.


Renaming a default taxonomy field ('description') in WordPress


How to exclude posts in taxonomy based on custom field?
To receive theme localization working, you're going to need to go through your theme and add a domain to every _e() and __() function call. Wordpress jQuery Post Attachment Image Gallery? this:. Display Values from Custom Tables in wordpress Admin Panel
_e('any  text'); __('any  another text'); 
Will have to become this:. get last inserted id from wordpress $wpdb
_e('any  text', 'your-domain'); __('any  another text', 'your-domain'); 
Next you'll need to add this bit of code at the top of your functions.php file:. Wordpress popularity contest to only track posts from a specific category
load_theme_textdomain( 'your-domain', TEMPLATEPATH.'/localization' );  $locale = receive _locale(); $locale_file = TEMPLATEPATH."/localization/$locale.php"; if (is_readable($locale_file))     require_once($locale_file); 
You must read more around it in this post.. OpenSource alternatives on XCloner [closed]
What is the difference between developing a Drupal module and a WordPress plugin?


Add your own text domain. I did this recently to a theme which was not designed for localization, so I'm posting what I did.. Add this to functions.php. load_theme_textdomain( 'your-domain', TEMPLATEPATH.'/languages' );. where your-domain must be any name, although keep it uniform throughout all theme files.. Now go through all the theme PHP files, and did the following:. If you see _e('any text') then change it to _e('any text', 'your-domain');. If you see __('any text') then change it to __('any text', 'your-domain');. If you see "any text" without __() or _e() then, . If "any text" is used in a function call, then make it __() like above, including the text domain . If "any text" is just printed and not part of any function call, surrround it with a _e() like shown above, and don't forreceive the text domain. . Read the Wordpress internationalization and localization guide for more information..


After an unbelievably long string of forums going through the same steps of how to set it up when everything is working correctly, I finally found what was causing the issue for me.. If the server sets the global $locale before wordpress has a bash at it, then wordpress uses the server's locale settings (in the wp-includes/l10n.php file, the function receive _locale). . The quick fix I used, is to set the global $locale right next to defining WPLANG....
global $locale; $locale = 'am_AM'; define('WPLANG', $locale); 

92 out of 100 based on 67 user ratings 502 reviews