Welcome Guest, Not a member yet? Register   Sign In
An input field translated in to many languages in the same form view
#1

(This post was last modified: 04-09-2021, 01:48 PM by sdiri.)

Hello,

I want to provide a translation of three labels but I can't find how to do it in the same form:



Code:
<form>
     <h2><?= lang('forms.SERVICE_FORM_TITLE'); ?></h2> <--- no problem with the default translation based on the app lang

    <label><?= lang('forms.en.SERVICE') ?> <span class="text-danger">*</span></label>
    <input name="serv_en" class="form-control" value="" type="text">

    <label><?= lang('forms.fr.SERVICE') ?> <span class="text-danger">*</span></label>
    <input name="serv_fr" class="form-control" value="" type="text">

    <label><?= lang('forms.es.SERVICE') ?> <span class="text-danger">*</span></label>
    <input name="serv_es" class="form-control" value="" type="text">
</form>

Thank you
Reply
#2

(04-09-2021, 10:22 AM)sdiri Wrote: Hello,

I want to provide a translation of three labels but I can't find how to do it in the same form:



Code:
<form>
     <h2><?= lang('forms.SERVICE_FORM_TITLE'); ?></h2> <--- no problem with the default translation based on the app lang

    <label><?= lang('forms.en.SERVICE') ?> <span class="text-danger">*</span></label>
    <input name="serv_en" class="form-control" value="" type="text">

    <label><?= lang('forms.fr.SERVICE') ?> <span class="text-danger">*</span></label>
    <input name="serv_fr" class="form-control" value="" type="text">

    <label><?= lang('forms.es.SERVICE') ?> <span class="text-danger">*</span></label>
    <input name="serv_es" class="form-control" value="" type="text">
</form>

Thank you


After serveral attempts i finalu got it:

If some one face the same problem here's the solution 
Code:
<h2><?= lang('forms.SERVICE_FORM_TITLE'); ?></h2>


    <label><?= lang("forms.SERVICE", [], 'en'); ?> <span class="text-danger">*</span></label>
    <input name="serv_en" class="form-control" value="" type="text">

    <label><?= lang("forms.SERVICE", [], 'fr'); ?>.fr.SERVICE') ?> <span class="text-danger">*</span></label>
    <input name="serv_fr" class="form-control" value="" type="text">

    <label><?= lang("forms.SERVICE", [], 'es'); ?> <span class="text-danger">*</span></label>
    <input name="serv_es" class="form-control" value="" type="text">
Reply




Theme © iAndrew 2016 - Forum software by © MyBB