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 ?
bump..
What does wpml-config.xml file do?
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
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
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
