Translating strings in functions.php (yet once again)
-
Hi,
I followed the instructions in this page: https://localise.biz/wordpress/plugin/child-themes
But I can’t get Loco to recognise the translatable strings in my functions.php.
Here’s what I did
1) added the following function to my child theme’s functions.php at the top of the filefunction AIPOWERSEO_setup() { load_child_theme_textdomain( 'AIPOWER', get_stylesheet_directory().'/languages' ); } add_action( 'after_setup_theme', 'AIPOWER_setup' );
Remark: When I copied and pasted the above snippet from the manual, I couldn’t save the file functions.php. In the error log I found a message warning me of a possible SQL injection. Only after removing the line “$path = get_stylesheet_directory().’/language'” and putting it directly into the signature of load_child_theme_textdomain I could get it to let me save it.
2) in another function, further below, I marked the translatable strings like this:
$checkout_data_label_name = __('<br/><strong>Customer Name:</strong> ', 'AIPOWER');
3) I created a new template file for the child theme following the messages in Loco Translate in WP Admin page
4) I created a new language file for the template, selecting Swiss German from the list.
Now, the template only has three entries, the first three lines from the child theme’s CSS file. But not the strings I added like shown in step 2).
What am I overlooking?
Thank you in advance for any pointers.
Nina
- The topic ‘Translating strings in functions.php (yet once again)’ is closed to new replies.