0 Replies Latest reply: Apr 22, 2014 2:47 PM by AlexandreKrabbe RSS

    How to translate shoppingcartsummary and whoisloggedin strings

    AlexandreKrabbe

      Hello guys,

       

           I`ve been struggling to translate my eCommerce website to portuguese. So far Mario`s post has been of some help (http://forums.adobe.com/docs/DOC-1808). However it does not show how to translate the strings "No one is logged in" and "Shopping cart is empty", after some research I`ve found that quite a few people wants to know how to do that but all the posts related to this are over a year old that might be the reason why the solution I found in this post (http://forums.adobe.com/message/4848069) did not work. There Frank said to add the following script:

      <!--This script translates "Shopping cart is empty" in something else.-->

              <script type="text/javascript">

       

                $.fn.replaceText = function( search, replace, text_only ) {

        return this.each(function(){

          var node = this.firstChild,

            val,

            new_val,

            remove = [];

          if ( node ) {

            do {

              if ( node.nodeType === 3 ) {

                val = node.nodeValue;

                new_val = val.replace( search, replace );

                if ( new_val !== val ) {

                  if ( !text_only && /</.test( new_val ) ) {

                    $(node).before( new_val );

                    remove.push( node );

                  } else {

                    node.nodeValue = new_val;

                  }

                }

              }

            } while ( node = node.nextSibling );

          }

          remove.length && $(remove).remove();

        });

      };

       

       

      $(".cartSummaryItem").replaceText( "Shopping cart is empty.", "Your own translation." );

       

       

      </script>

      right before the </body> tag. On the same post they were asking on how to translate quite a few other modules but all I need are those two, the site is supposed to be released in a week and I still couldn`t figure out how to do it manually since BC does not offer portuguese as a culture for the domain I`m using (http://www.primenutricao.com.br).

       

      Cheers,

      Alex.