Functions for translating arbitrary strings (text that is not post content). Used for theme labels, button text, widget titles, page builder content, and any other hardcoded strings in templates.
Translating Strings
Lang Forge works with standard WordPress translation functions. Use __(), _e(), esc_html__(), and esc_html_e() with your theme’s text domain. When auto-registration is enabled for your text domain, Lang Forge automatically detects these strings and makes them available for translation in the admin panel.
<h1><?php echo esc_html__('Welcome to our store', 'theme'); ?></h1>
<p><?php echo esc_html__('Browse our collection of handmade goods', 'theme'); ?></p><button class="btn-submit">
<?php _e('Submit Form', 'theme'); ?>
</button>
<footer>
<p><?php _e('All rights reserved', 'theme'); ?></p>
</footer>// Translate the template, then fill in dynamic values
$template = __('Showing %d results for "%s"', 'theme');
echo sprintf($template, $count, esc_html($search_term));<a href="<?php the_permalink(); ?>" class="btn btn-primary">
<?php echo esc_html__('Read More', 'theme'); ?>
</a>function theme_breadcrumbs() {
$home_label = __('Home', 'theme');
$separator = ' » ';
echo '<nav class="breadcrumbs">';
echo '<a href="' . esc_url(home_url('/')) . '">' . esc_html($home_label) . '</a>';
if (is_category()) {
echo $separator . esc_html(single_cat_title('', false));
} elseif (is_single()) {
$categories = get_the_category();
if ($categories) {
echo $separator . '<a href="' . esc_url(get_category_link($categories[0]->term_id)) . '">';
echo esc_html($categories[0]->name) . '</a>';
}
echo $separator . esc_html(get_the_title());
}
echo '</nav>';
}—