WidgetCoreWidgetCore Documentation

Language and translation

Translating WidgetCore — the bundled language files, the load order, every translatable string, building a new translation with the POT file, and RTL/LTR handling.

The plugin ships complete Persian and English translations and a POT template for any other language. All interface texts come from these files — nothing is hardcoded in the output.

Language files

FileLanguageStatus
languages/widgetcore-fa_IR.mo / .poPersianComplete, bundled
languages/widgetcore-en_US.mo / .poEnglishComplete, bundled
languages/widgetcore.potTemplateFor building a new translation

Translations are loaded on init at priority 1:

php
load_plugin_textdomain( 'widgetcore', false, dirname( plugin_basename( __FILE__ ) ) . '/languages' );

Load order

WordPress resolves the current locale with determine_locale() and then looks for the .mo file in this order:

PriorityPathNotes
1wp-content/languages/plugins/widgetcore-{locale}.moThe global directory — your file wins here
2wp-content/plugins/widgetcore/languages/widgetcore-{locale}.moThe bundled translation

Strings that get translated

AreaExamples
Widget titles and descriptions“FAQ”, “Live Search”, the category name
Control labels“Results display mode”, “Items per page”, “Query ID”
Control descriptions and help textThe notes under each control
Default field valuesThe placeholder text, “All text”
Front-end messages“No results found.”, “Error fetching results.”, “N results”
Pagination labels“Previous”, “Next”, “Page”, “of”, “Load more”
Shortcode defaults“View more posts”, “There are no more posts.”
Admin noticesThe updater messages
Schema-related labelsOnly labels; question and answer content come from your data

The strings that reach the browser are passed through the inline window.WGCRSearch.i18n object, so the client-side messages are translated too:

js
window.WGCRSearch.i18n = {
	noResults: 'No results found.',
	found: 'results',
	error: 'Error fetching results.',
	prev: 'Previous',
	next: 'Next',
	page: 'Page',
	pageOf: 'of'
};

Building a translation for a new language

  1. Copy the template

    Copy languages/widgetcore.pot to wp-content/languages/plugins/widgetcore-de_DE.po.

  2. Translate with an editor

    Poedit, Loco Translate or any PO editor; keep the msgid values untouched.

  3. Watch the placeholders

    Strings containing %s or %d must keep them, in an order that works in your language.

  4. Compile the .mo

    Your editor does this automatically; the .mo must sit next to the .po.

  5. Set the site language

    “Settings → General → Site Language”, or a per-user language in your profile.

  6. Verify

    Check the widget panel labels, the front-end messages and the pagination text.

RuleWhy
Keep placeholders (%s, %d, %1$s)They are filled at runtime; a missing one breaks the string
Do not translate code identifierswgcr-search, modal, page are values, not words
Keep the length reasonableLong labels overflow the Elementor panel and the results header
Use the same term consistently“Result” versus “Item” confuses visitors

Right-to-left and left-to-right

The plugin does not switch direction itself; it follows the document direction:

DirectionSourceEffect on the widgets
RTL<html dir="rtl"> from the theme or the localeIcons, panel alignment and pagination flip automatically
LTR<html dir="ltr">The same stylesheet, mirrored by logical properties

Because the CSS uses logical properties (inset-inline-start, margin-inline, border-inline-start, text-align: start), there is a single stylesheet for both directions and no rtl.css file to maintain.

Translating your own content

The plugin translates its interface, not your content:

WhatTranslated by
Widget labels and messagesThe plugin's .mo files
Question and answer textYou, in the Elementor editor
Result titles and excerptsThe posts themselves
The placeholder you typedYour own text (a per-language widget if you need several)

On a multilingual site, place one widget per language and point its Source at the post type used by that language; the interface texts then follow the active locale automatically.