Community mailing list archives

community@mail.odoo.com

Re: Flag language

by
Laura
- 06/01/2016 07:29:30



SOLUTION:

$(function(){
      $('.lang:contains("IT")').html('<img src="/website/static/src/img/IT.png"/>')
})

;D 




Laura Muñoz
Departament de Disseny
administracio@syc-cylinders.eu
SYC Cylinders Europe, SA
Huelva, 1
08940 Cornellà de Llobregat
Barcelona

T 93 336 36 17
F 93 335 81 22
info@syc-cylinders.eu

www.syc-cylinders.eu




El 1 jun 2016, a las 11:55, Administracio <administracio@syc-cylinders.eu> escribió:


<span id="cid:6AA6D148-3685-4A61-9190-D6BBCC652F39@Home"><PastedGraphic-2.tiff>



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:


<li>
      <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;"/>
                        </a>
              </li>
              <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=#{website.id}&amp;url_return=#{url_return}"><span class="fa fa-plus-circle"/> Add language... </a>
               </li>
       </ul>
</li>


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;">
       <li>
           <a href="/en_US/page/homepage" title="idiomas languages syc cylinders" rel="contents">
                     <span id=“????????” style=“color: #000000; text-decoration: none;”>EN</span>   
            </a>
        </li>
<li>
             <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>
              </a>
         </li>
<…>

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.

Thanks!  



Laura Muñoz
Departament de Disseny
administracio@syc-cylinders.eu
SYC Cylinders Europe, SA
Huelva, 1
08940 Cornellà de Llobregat
Barcelona

T 93 336 36 17
F 93 335 81 22
info@syc-cylinders.eu

www.syc-cylinders.eu