
- MODX 3
- PHP 8.2
- Vue 3


Selects resources for the current localization and runs another snippet (pdoResources, pdoMenu, msProducts, ms3Products, and others) that joins the localizations table.
Fields pagetitle, longtitle, menutitle, description, introtext, content come from localizator3_content. seotitle and keywords are not in the listing SELECT.
localizator3_default_from_resource, an empty cell uses the document value.localizator3_default_from_resource and a non-base key, an empty cell stays empty; a missing row (id IS NULL) uses the document value.menutitle uses the localized pagetitle, otherwise the document menutitle.Direct pdoResources or pdoMenu with fetch class ModxPro\PdoTools\FetchLocalizator join the same fields if a localizator join is not already present. The getLocalizedResources wrapper adds the join itself. Legacy pdoFetchLocalizator does not.
uri has no leading slash (en/page.html).link from makeUrl has a leading slash./ gets no language prefix.FetchLocalizator writes the prefix.| Name | Default | Description |
|---|---|---|
| snippet | pdoResources | Snippet to run. name@propertySet is allowed |
| class | modResource | Object class. For msProducts and ms3Products the MiniShop3 product class is used |
| localizator3_key | current | Language key. Inserted into SQL as-is; case is not normalized |
| onlyWithLocalization | No | INNER JOIN only to rows with the same key and active = 1. With localizator3_default_from_resource and the default key, getListingQuery builds no join: the parameter filters nothing |
The wrapper merges where, leftJoin, innerJoin, and select with its localization query and passes the merged values to the inner snippet. Other parameters are passed through unchanged.
{'!getLocalizedResources' | snippet : [
'snippet' => 'pdoMenu',
'parents' => 0,
'level' => 1,
]}[[!getLocalizedResources?
&snippet=`pdoMenu`
&parents=`0`
&level=`1`
]]{'!pdoPage' | snippet : [
'element' => 'getLocalizedResources',
'snippet' => 'pdoResources',
'parents' => 0,
'limit' => 10,
'tpl' => '@INLINE <li><a href="/{$uri}">{$pagetitle}</a></li>',
]}[[!pdoPage?
&element=`getLocalizedResources`
&snippet=`pdoResources`
&parents=`0`
&limit=`10`
&tpl=`@INLINE <li><a href="/[[+uri]]">[[+pagetitle]]</a></li>`
]]msProducts and ms3Products are handled the same way. A product inherits the resource: localization lives in localizator3_content by resource_id. The Localization tab opens for msProduct as well.
{'!getLocalizedResources' | snippet : [
'snippet' => 'ms3Products',
'parents' => 5,
'tpl' => '@INLINE <div><a href="/{$uri}">{$pagetitle}</a></div>',
'onlyWithLocalization' => 1,
]}[[!getLocalizedResources?
&snippet=`ms3Products`
&parents=`5`
&tpl=`@INLINE <div><a href="/[[+uri]]">[[+pagetitle]]</a></div>`
&onlyWithLocalization=`1`
]]| Model | Purpose |
|---|---|
locOption | Option caption and description by option_id and language |
locProductOption | Product option value by product_option_id and language |
{$option_id | locoptioncaption}
{$option_id | locoptioncaption : 'Default'}
{$product_option_id | locproductoptionvalue}
{$product_option_id | locproductoptionvalue : '—'}Option description via PHP localizator::getLocalizedOptionDescription($option_id, $default). There is no Fenom modifier for it.
With localizator3_default_from_resource and the default language key, locoptioncaption and locproductoptionvalue return the second argument or an empty string and do not read locOption / locProductOption.
On mSearch events the plugin adds index fields like {key}-{field}: en-pagetitle, en-content. After editing a localization, reindex the catalog in mSearch.
For a language other than localizator3_default_language, the mSearch call usually needs a fields parameter with key prefixes. Check the mSearch snippet contract in its docs.
The getLocalizedField snippet:
| Name | Default | Description |
|---|---|---|
| id | current resource | Resource ID. Empty null and '' use the current resource. Pass &id for another resource |
| field | pagetitle | Field or TV |
| language | current | Language key |
| default | empty | Fallback. Setting off: after an empty active localization and an empty document field. Setting on and non-base key: default even if the document field is filled. Setting on and base key: localization is not read; an empty resource field returns default |
{'!getLocalizedField' | snippet : [
'id' => 12,
'field' => 'pagetitle',
'language' => 'en',
]}[[!getLocalizedField?
&id=`12`
&field=`pagetitle`
&language=`en`
]]With localizator3_default_from_resource = true and key localizator3_default_language, the value comes from resource fields. The localizator3_content row is not read, even when active = 1.
For another key:
active = 1;default, not the document field or TV.For TVs:
localizator3_enabled flag is required to read locTemplateVarResource (not on the base language when localizator3_default_from_resource is on);default;0 is.In a web context an unpublished or deleted resource returns default immediately (before reading localization). The locfield modifier does not repeat that filter. The language argument / key in locfield goes through resolveLanguageKey: EN and en look up the stored key.
getCurrentLanguage The snippet returns a field of the current language: key, cultureKey, name, or http_host.
| Name | Default | Description |
|---|---|---|
| field | key | key, cultureKey, name, or http_host. key comes from localizator3_key without a database query. An empty cultureKey falls back to key; name and http_host are read from the language row |
| format | empty | json returns a JSON string |
Without localizator3_key the result is empty; with format=json it is "". name and http_host are also empty when the language row is missing.
{'!getCurrentLanguage' | snippet : ['field' => 'key']}
{'!getCurrentLanguage' | snippet : ['field' => 'name', 'format' => 'json']}[[!getCurrentLanguage? &field=`key`]]
[[!getCurrentLanguage? &field=`name` &format=`json`]]A non-numeric first argument is the field name of the current resource.
{'pagetitle' | locfield}
{$id | locfield : 'pagetitle'}
{$id | locfield : 'introtext'}On the TV form, enable «TV is available in localizations» — the field then appears on the Localization tab.
In listings, includeTVs on pdoResources reads the localized value by TV name when the flag is on and the fetch class is FetchLocalizator. Without the flag, the document TV remains.
Auto-translation walks nested MIGX fields only if the TV name is listed in localizator3_translate_fields. The default list has no TV names.