Title: Localization product name
Last modified: August 31, 2016

---

# Localization product name

 *  Resolved [endwin](https://wordpress.org/support/users/endwin/)
 * (@endwin)
 * [10 years, 4 months ago](https://wordpress.org/support/topic/localization-product-name/)
 * Hi all.
    I use qTranslate-x and have text in db in format `[:cs]nejaky text[:
   en]some text[:]` And in this plugin have product name in this format to… So i
   do small function:
 *     ```
       /*localization function*/
         function locali($str){
   
           $before='[:';   //set your first piece localization identifikater (default for [:en]some text[:cs]nejaky text[:]) so first piece is [:
           $after=']';     //set your last piece localization identifikater (default for [:en]some text[:cs]nejaky text[:]) so last piece is ]
   
           $loc=explode('_',get_locale());
           $l=$loc[0];
           $la=$before.$l.$after;
           if(strstr($str,$la)){
             $lange=explode($before, $str);
             foreach ($lange as $value){
               $val=explode($after, $value);
               if(($val[0])&&($val[1])){
                 $lang[$val[0]]=$val[1];
               }
             }
             echo $lang[$l];
           }else{
             echo $str;
           }
         }
       /*End localization*/
       ```
   
 * I add this about line 31. (must be in `<?php ?>)`
 * And must add call this function…
    I rewrite this: `echo ' href="' . get_permalink().'"
   target="_blank">' . $out_of_stock_message . $product->get_title() . '</a>';`
 * To this:
 *     ```
       echo ' href="' . get_permalink() . '" target="_blank">' . $out_of_stock_message;
               locali($product->get_title());
               echo '</a>';
       ```
   
 * And is it all:-)
    This function do localization by actual wp lang…
 * If you have in product name other delimiter than `[:]`
    for example `<!--:en--
   >some text<!--:-->` only rewrite $before on `'<!--:'` and $after on `'-->'`
 * I hope someone use it.:-D
 * [https://wordpress.org/plugins/mq-woocommerce-products-price-bulk-edit/](https://wordpress.org/plugins/mq-woocommerce-products-price-bulk-edit/)

The topic ‘Localization product name’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/mq-woocommerce-products-price-bulk-
   edit_b3658d.svg)
 * [Woocommerce Products Price Bulk Edit](https://wordpress.org/plugins/mq-woocommerce-products-price-bulk-edit/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/mq-woocommerce-products-price-bulk-edit/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/mq-woocommerce-products-price-bulk-edit/)
 * [Active Topics](https://wordpress.org/support/plugin/mq-woocommerce-products-price-bulk-edit/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/mq-woocommerce-products-price-bulk-edit/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/mq-woocommerce-products-price-bulk-edit/reviews/)

## Tags

 * [Localization](https://wordpress.org/support/topic-tag/localization/)

 * 0 replies
 * 1 participant
 * Last reply from: [endwin](https://wordpress.org/support/users/endwin/)
 * Last activity: [10 years, 4 months ago](https://wordpress.org/support/topic/localization-product-name/)
 * Status: resolved