Translate-plugin: Location plugin, form select country/state does not translate.

Created on 29 Jun 2018  路  2Comments  路  Source: rainlab/translate-plugin

I use Location plugin. Front-end usage partial on profile page:

{% set countryId = countryId|default(form_value('country_id')) %}
{% set stateId = stateId|default(form_value('state_id')) %}

<div class="form-group">
    <label for="accountCountry">Country</label>
    {{ form_select_country('country_id', countryId, {
        id: 'accountCountry',
        class: 'form-control',
        emptyOption: '',
        'data-request': 'onInit',
        'data-request-update': {
            'country-state': '#partialCountryState'
        }
    }) }}
</div>

<div class="form-group">
    <label for="accountState">State</label>
    {{ form_select_state('state_id', countryId, stateId, {
        id: 'accountState',
        class: 'form-control',
        emptyOption: ''
    }) }}
</div>
<div id="partialCountryState">
    {% partial 'country-state' countryId=user.country_id stateId=user.state_id %}
</div>

I get the default (en) language on output.

袨n the user's public page:
{{ user.country.name }}
the translation is displayed correctly.

What do I need to do to translate form select country/state?

Plugin Translate 1.3.8
Plugin Location 1.0.7
Build 436

Abandoned Question

Most helpful comment

Found a bad way. In Country Model:
replace on:
->get()->lists('name', 'id');
instead:
->lists('name', 'id');

but it turns out more than 100 queries, to Db.

Maybe someone has ideas?

All 2 comments

Found a bad way. In Country Model:
replace on:
->get()->lists('name', 'id');
instead:
->lists('name', 'id');

but it turns out more than 100 queries, to Db.

Maybe someone has ideas?

Closing as it has been over a month since any activity on this occurred and we are trying to figure out what issues are still relevant. If this is still something that you would like to see through to fruition please respond and we can get the ball rolling.

Was this page helpful?
0 / 5 - 0 ratings