ThemeForest

wpml and slightly modified options framework

221 posts
  • Bought between 1 and 9 items
  • Exclusive Author
  • Has been a member for 2-3 years
  • India
  • Microlancer Beta Tester
  • Sold between 1 000 and 5 000 dollars
atinder says

Hi, i noticed a problem if we translate theme options strings using wpml-config.xml file and then when next time we load the options panel again translated strings are there in text fields not the original ones i entered, they are lost.

is there any way to do it correctly ?

221 posts
  • Bought between 1 and 9 items
  • Exclusive Author
  • Has been a member for 2-3 years
  • India
  • Microlancer Beta Tester
  • Sold between 1 000 and 5 000 dollars
atinder says

:( bump..

282 posts
  • Attended a Community Meetup
  • Sold between 10 000 and 50 000 dollars
  • Exclusive Author
  • Bought between 10 and 49 items
  • Has been a member for 1-2 years
  • Referred between 1 and 9 users
SyamilMJ says

What does wpml-config.xml file do?

221 posts
  • Bought between 1 and 9 items
  • Exclusive Author
  • Has been a member for 2-3 years
  • India
  • Microlancer Beta Tester
  • Sold between 1 000 and 5 000 dollars
atinder says

wpml-config.xml file is used by wpml plugin for translation. it looks like this

<admin-texts> <key name=”smof-option-name”> <key name=”footer_text” /> <key name=”sub_option_2” /> </key> </admin-texts>

if you see this website www.empresasbambu.com, its using smof framework and wpml plugin for translation. so we have same website in English as well as Spanish.

plugin translates the strings in english to spanish using filters on get_option for frontend but when we use get_option in framework i think filters are applied to that as well, so we see spanish text in option fields instead of english, if we hit save now spanish text will be saved and english strings are lost.

hope i didn’t confused much.

thanks

221 posts
  • Bought between 1 and 9 items
  • Exclusive Author
  • Has been a member for 2-3 years
  • India
  • Microlancer Beta Tester
  • Sold between 1 000 and 5 000 dollars
atinder says

wpml-config.xml file is used by wpml plugin for translation. it looks like this

<admin-texts> <key name=”smof-option-name”> <key name=”footer_text” /> <key name=”sub_option_2” /> </key> </admin-texts>

if you see this website www.empresasbambu.com, its using smof framework and wpml plugin for translation. so we have same website in English as well as Spanish.

plugin translates the strings in english to spanish using filters on get_option for frontend but when we use get_option in framework i think filters are applied to that as well, so we see spanish text in option fields instead of english, if we hit save now spanish text will be saved and english strings are lost.

hope i didn’t confused much.

thanks

282 posts
  • Attended a Community Meetup
  • Sold between 10 000 and 50 000 dollars
  • Exclusive Author
  • Bought between 10 and 49 items
  • Has been a member for 1-2 years
  • Referred between 1 and 9 users
SyamilMJ says

Not really sure how WPML work, but the workaround strategy should be creating two sets of options id, e.g.

mytheme_options (default id)

mytheme_options_es (spanish option id)

Presumably that if WPML have conditional function that can determine which option is being requested on front end, then you can do something like:

if($lang == 'en') {
define( 'OPTIONS', preg_replace("/[^A-Za-z0-9 ]/", '', $theme_name).'_options' );
} elseif ($lang == 'es') {
define( 'OPTIONS', preg_replace("/[^A-Za-z0-9 ]/", '', $theme_name).'_options_es' );
}

You said WPML uses a filter in get_option, what’s the filter’s name?

Also, next time open a thread here – https://github.com/sy4mil/Options-Framework/issues

by
by
by
by
by