Title: Language Issue
Last modified: August 21, 2016

---

# Language Issue

 *  Resolved [DrHariri](https://wordpress.org/support/users/ala7lam/)
 * (@ala7lam)
 * [12 years, 7 months ago](https://wordpress.org/support/topic/language-issue-3/)
 * Hi,
 * I am trying to setup achievement types. However, I noticed that if I use Arabic
   to register the new achievement types, I get all kind of issues and it doesn’t
   register. I’ve tried to set the slug to an English name but that didn’t help.
 * I think the issue is that Arabic names transfer to something very long when outputted
   as a URL.
 * I was wondering if there is any workaround this or at least if you think of a
   simple filter to replace the English name of the achievement type across the 
   site if needed.
 * Thank you!
 * [http://wordpress.org/plugins/badgeos/](http://wordpress.org/plugins/badgeos/)

Viewing 14 replies - 1 through 14 (of 14 total)

 *  [Michael Beckwith](https://wordpress.org/support/users/tw2113/)
 * (@tw2113)
 * The BenchPresser
 * [12 years, 7 months ago](https://wordpress.org/support/topic/language-issue-3/#post-4308513)
 * Sorry about the very long delay in replying to this. I’m not quite sure how to
   approach this one, to be honest. Curious if you’ve made any headway since, or
   if you still need some guidance on best path forward.
 *  Thread Starter [DrHariri](https://wordpress.org/support/users/ala7lam/)
 * (@ala7lam)
 * [12 years, 7 months ago](https://wordpress.org/support/topic/language-issue-3/#post-4308514)
 * Hi Michael,
 * Thanks for replying!
 * I am developing the website and ignored it for the type being, but I really hope
   there is someway this could work.
 * Do you think it’s possible to force the plugin to use english letters for the
   coding stuff perhaps based on the slug?
 * Thanks!
 *  [Michael Beckwith](https://wordpress.org/support/users/tw2113/)
 * (@tw2113)
 * The BenchPresser
 * [12 years, 7 months ago](https://wordpress.org/support/topic/language-issue-3/#post-4308515)
 * Well, just so we can be clear, where are you inputting the text that’s causing
   it to break? Which input fields?
 *  Thread Starter [DrHariri](https://wordpress.org/support/users/ala7lam/)
 * (@ala7lam)
 * [12 years, 7 months ago](https://wordpress.org/support/topic/language-issue-3/#post-4308516)
 * The Achievement types ones. Basically, I was trying to get an achievement type
   and used Arabic letters. I tried defining an English slug but it’s probably not
   using the slug.
 * I guess one approach could be to create them in English but then user filters
   or translation files somehow to output the Arabic words for the achievement titles?
 * Thanks a lot for helping with this!
 *  [Michael Beckwith](https://wordpress.org/support/users/tw2113/)
 * (@tw2113)
 * The BenchPresser
 * [12 years, 6 months ago](https://wordpress.org/support/topic/language-issue-3/#post-4308519)
 * The Filter/translation files may be your best bet at the moment.
 * The issue really is determining which fields get used to create aspects related
   to the url and achievement slug, and if it’s always an isolated field. I *think*
   there may be some spots that are treated as fallback values if another isn’t 
   specified
 *  Thread Starter [DrHariri](https://wordpress.org/support/users/ala7lam/)
 * (@ala7lam)
 * [12 years, 6 months ago](https://wordpress.org/support/topic/language-issue-3/#post-4308520)
 * Will hopefully try that. Care (please!) to give me a few tips before I try this
   lol. I am no coder :).
 * Thanks!
 *  [Michael Beckwith](https://wordpress.org/support/users/tw2113/)
 * (@tw2113)
 * The BenchPresser
 * [12 years, 6 months ago](https://wordpress.org/support/topic/language-issue-3/#post-4308521)
 * For which parts? the filters and translation?
 *  Thread Starter [DrHariri](https://wordpress.org/support/users/ala7lam/)
 * (@ala7lam)
 * [12 years, 6 months ago](https://wordpress.org/support/topic/language-issue-3/#post-4308522)
 * Yes please, is there a simple filter that I could use within functions.php to
   replace the achievement types names in the front-end which I could then add as
   needed for all types text to be replaced?
 * Otherwise, how do you suggest I go through the translation route?
 * Thanks!
 *  [Michael Beckwith](https://wordpress.org/support/users/tw2113/)
 * (@tw2113)
 * The BenchPresser
 * [12 years, 6 months ago](https://wordpress.org/support/topic/language-issue-3/#post-4308539)
 * Hello again, we’re looking into how to easily get around this. It’s a bit of 
   a missed design consideration with how we register the post types, and I want
   to do what we can to make it so all languages can register their achievements
   properly and successfully. Thank you for your patience here.
 *  [Michael Beckwith](https://wordpress.org/support/users/tw2113/)
 * (@tw2113)
 * The BenchPresser
 * [12 years, 6 months ago](https://wordpress.org/support/topic/language-issue-3/#post-4308540)
 * Could you share some example Arabic text that you’ve been using so that we can
   test a few things on our end for this? Also which screen you’re using these on,
   just so that we can be sure to be testing in the right area.
 *  Thread Starter [DrHariri](https://wordpress.org/support/users/ala7lam/)
 * (@ala7lam)
 * [12 years, 6 months ago](https://wordpress.org/support/topic/language-issue-3/#post-4308541)
 * Hi Michael,
 * Thanks for getting back to me and for helping resolve the issue and making the
   plugin work with other languages.
 * To answer your question, I tried using an Arabic name for the achievement type,
   this resulted in the following problems for me:
    - Inability to define steps per badge as when I click on the button to define
      the step nothing happens.
    - When I click view to view the badge, I get an 404 error page.
 * I’ve tried to use another achievement type which I used English to create, I 
   was able to view the badge page in the front-end and was able to define steps.
 * Back to the achievement type I created in Arabic, I was trying to use the word
   إنجاز as the title and a similar word as the plural form إنجازات. This caused
   the URL structure for this particular achievement type to look strange. You can
   see this pictures to get an idea of what I meant:
 * [Arabic Name used for achievement type and achievement post](https://www.dropbox.com/s/s5lreeahaxx4tst/Screenshot%202013-12-03%2021.54.29.png).
   You can see the link looks strange and very long.
 * [English Name used for achievement type but Arabic for post, but English for slug to be safe](https://www.dropbox.com/s/l01gv9ye2m2nm3d/Screenshot%202013-12-03%2021.54.36.png)(
   all working).
 * I hope I was of little help to provide the information that might. I guess one
   possible solution would be to offer a way to define the slug that would be used
   for the URL structure and have that defined as part of the achievement type creation
   rather than having it auto-generated from the achievement type title.
 * I am happy to help provide further information or test possible solutions.
 *  [Michael Beckwith](https://wordpress.org/support/users/tw2113/)
 * (@tw2113)
 * The BenchPresser
 * [12 years, 6 months ago](https://wordpress.org/support/topic/language-issue-3/#post-4308542)
 * Some notes for you to hopefully help you understand how these are processed while
   we try to find a preventive way to solve this for all languages.
 * Each “achievement” you register are posts in a post type that the plugin registers
   itself. When it comes time, we loop through all of the achievement types made,
   and create post types for those. Post type used to create post types.
 * It’ll grab the post title for the achievement, and set some hidden meta fields
   name _badgeos_singular_name and _badgeos_plural_name. If the singular name saved
   already doesn’t match the post title, it’ll update that to match. If there isn’t
   a plural form saved already, it’ll save the same value, otherwise not touch the
   plural.
 * After that, it’ll pull the values saved in those two meta fields, and continue
   on to registering the post types. It’s at that point that the singular value 
   is run through the following:
 *     ```
       sanitize_title( substr( strtolower( $achievement_name_singular ), 0, 20 ) )
       ```
   
 * Working from inside out: strtolower will make all of the characters lowercase,
   substr will trim the value to 20 characters, as that’s the max allowed for post
   type slugs, and then it runs the value through sanitize_title(). That will make
   the text “WordPress slug ready” aka clean up parts of it, replace spaces with-‘
   s or _’s and so on.
 * I have to wonder if there’s something going on within that, specifically the 
   sanitize_title() part and perhaps some character encoding. However, we’ll be 
   trying to find the permanent solution over here, with the information you provided
   above.
 *  Thread Starter [DrHariri](https://wordpress.org/support/users/ala7lam/)
 * (@ala7lam)
 * [12 years, 6 months ago](https://wordpress.org/support/topic/language-issue-3/#post-4308543)
 * Hi Michael,
 * Thanks for your response! I too think that the issue is cause by the sanitize_title().
 * I look forward to any solutions you propose :). Please let me know if you want
   me to test anything.
 * Many thanks!
 *  [Michael Beckwith](https://wordpress.org/support/users/tw2113/)
 * (@tw2113)
 * The BenchPresser
 * [12 years, 5 months ago](https://wordpress.org/support/topic/language-issue-3/#post-4308589)
 * Good day Ala7lam.
 * It’s been awhile, but I have not forgotten. I also don’t have a BadgeOS level
   solution or any fix that will be getting submitted to the code.
 * However, I’ve been googling around about how to get around this issue. It’d need
   to be tested and made sure it’s working right. I have been comparing content 
   I enter within the WP Admin to what actually gets saved to the database, and 
   it looks like the *only* problem areas are the post_name and post_slug fields
   for this. So my thoughts were to see if you could have a working achievements
   set in Arabic, but without the post type in the urls. I have provided a url to
   a tutorial that does a lot of that, but will need to be edited a bit to fit your
   particular setup. If it doesn’t work, perhaps someone else has done up a tutorial
   that does. The idea is the key part, removing the slug from the urls for the 
   achievement types.
 * [http://ryansechrest.com/2013/04/remove-post-type-slug-in-custom-post-type-url-and-move-subpages-to-website-root-in-wordpress/](http://ryansechrest.com/2013/04/remove-post-type-slug-in-custom-post-type-url-and-move-subpages-to-website-root-in-wordpress/)
 * Let me know your thoughts on this or if you’ve had any change of luck with it
   since we last talked.

Viewing 14 replies - 1 through 14 (of 14 total)

The topic ‘Language Issue’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/badgeos_85d3bc.svg)
 * [BadgeOS](https://wordpress.org/plugins/badgeos/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/badgeos/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/badgeos/)
 * [Active Topics](https://wordpress.org/support/plugin/badgeos/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/badgeos/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/badgeos/reviews/)

## Tags

 * [Arabic](https://wordpress.org/support/topic-tag/arabic/)
 * [language](https://wordpress.org/support/topic-tag/language/)

 * 14 replies
 * 2 participants
 * Last reply from: [Michael Beckwith](https://wordpress.org/support/users/tw2113/)
 * Last activity: [12 years, 5 months ago](https://wordpress.org/support/topic/language-issue-3/#post-4308589)
 * Status: resolved