Community mailing list archives

Flag language

- 06/01/2016 05:55:00

Hi Community,

I’m trying to install “website_lang_flags” module but it has errors. Then I have thought that I can substitute acronym language with images using javascript. 

Then if I have this code:

      <ul class="list-inline js_language_selector mt16" t-if="(request.website_multilang and len(languages) &gt; 1) or editable" style="padding-left: 15px;">
              <li t-foreach="languages" t-as="lg">
                       <a t-att-href="url_for(request.httprequest.path + '?' + keep_query(), lang=lg[0])" t-att-data-default-lang="editable and 'true' if lg[0] == website.default_lang_code else None" title="idiomas languages syc cylinders" rel="contents">
                                  <span t-esc="((lg[1].split('/').pop())[0:2]).upper()" style="color: #000000; text-decoration: none;"/>
              <li groups="base.group_website_publisher">
                         <t t-set="url_return" t-value="url_for('', '[lang]') + '?' + keep_query()"/>
                                     <a t-attf-href=“/web#action=base.action_view_base_language_install&amp;website_id=#{}&amp;url_return=#{url_return}"><span class="fa fa-plus-circle"/> Add language... </a>

I want to add id on span tag :

 <span id=“????????” t-esc=“((lg[1].split(‘/‘).pop())[0:2]).upper()" style="color: #000000; text-decoration: none;"/>

and I don’t know how can I put id with number because when the code it’s generate is:

<ul class="list-inline js_language_selector mt16" style="padding-left: 15px;">
           <a href="/en_US/page/homepage" title="idiomas languages syc cylinders" rel="contents">
                     <span id=“????????” style=“color: #000000; text-decoration: none;”>EN</span>   
             <a href="/page/homepage" data-default-lang="true" title="idiomas languages syc cylinders" rel="contents">
                        <span id=“????????” style=“color: #000000; text-decoration: none;">ES</span>

and then I want to add the code with id and number on loop, for example this way:

                     <span id=“lang0” style=“color: #000000; text-decoration: none;”>EN</span>
  <span id=“lang1” style=“color: #000000; text-decoration: none;”>ES</span>

But I don’t know how can I do it on backend code.

This way I could take id’s and replace with image flags with javascript.


Laura Muñoz
Departament de Disseny
SYC Cylinders Europe, SA
Huelva, 1
08940 Cornellà de Llobregat

T 93 336 36 17
F 93 335 81 22