0

I use a prefix in my url using "add_permastruct" in my functions.php:

www.mydomain.com/the_prefix/my_category/postname

But I would like to translate "the_prefix". For example, if my site is in english, I will use the prefix "articles" and If my site is in german I will use "artikel".

English: www.mydomain.com/en/articles/my_category/postname

German: www.mydomain.com/de/artikel/my_category/postname

Any ideas? I use WPML plugin

1
  • That functionality is what WPML supposed to be able to do. You should ask their support. Since WPML is a paid plugin with no free versions there is not much chance anybody here can give you any good answer. Feb 24, 2013 at 6:33

1 Answer 1

-1

I would use the following to check for each language and then output the translated permalink structure. For instance:

if(ICL_LANGUAGE_CODE==en){
//translate your english the_prefix here
}
if(ICL_LANGUAGE_CODE==de){
//translate your german the_prefix here
}

I'm not sure about this, but I would think that you should be able to use the icl_register_string() and icl_t() functions to register, and output the translated text inside the above if statements. You can find more info about those functions here: WPML Register Function

3
  • it is not enough to translate names here, you actually need to change the URL parsing/rewrite rules to have those pages accessible in those URLs. Feb 24, 2013 at 6:37
  • Thanks for your answer, Mark, but... How can I do it?
    – Mike
    Feb 24, 2013 at 12:24
  • Any solution,please?
    – Mike
    Feb 26, 2013 at 18:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.