0

I am trying to translate a wordpress theme to Arabic and I am totally new to the translation field.

I followed the steps in this question and I added a new domain to my theme instead of hard coding everything .

  1. I loaded my text domain in the functions file :

    add_action('after_setup_theme', 'lanugage_domain');
    function lanugage_domain(){
        load_theme_textdomain('users', get_template_directory() . '/languages');
    }
    
  2. I added every text in the theme with __() or _e() function for example

text --> __('text','users')

  1. I created a new PO file in my language directory with the name of users.pot with Poedit with the UTF-8 Charset

    3.1 - When I started scanning the files and error appeared to me

      01/11/2015 08:50:54: C:\Program Files (x86)\Poedit\GettextTools\bin\xgettext.exe: Non-ASCII comment at or before js/jquery.dialogBox.js:14.
      01/11/2015 08:50:54:                                                              Please specify the source encoding through --from-code
      01/11/2015    08:50:54:                                                              
      01/11/2015 08:50:54: Entries in the catalogue are probably incorrect.
      01/11/2015 08:50:54: Updating the catalogue failed. Click on 'Details >>' for details.
    

I didn't knew from where this error came from because I am using the UTF-8 charset, did I miss something ?

6
  • In the concern of translation, you need to put only English characters in the theme within any gettext function. And using a tool like POEdit or EasyPO you can then convert them to any language. I think the problem is occurring because you've already put any Arabic text somewhere in the theme, and it seems it's in a .js file. Try the Theme Check plugin to find any Non-ASCII character in your theme, and fix it first. Commented Nov 1, 2015 at 9:28
  • @MayeenulIslam For the response, I didn't add any Arabic letter to my project yet I tried Installing the plugin (polylang) it may added the Arabic letter somewhere (maybe) but now it is deactivated . And when I add an English text to my code I add it like this <?php echo __("text text","users"); ?>
    – Marox Tn
    Commented Nov 1, 2015 at 11:25
  • Please use Theme Check with "Suppress Info" unchecked. Commented Nov 1, 2015 at 12:12
  • What does said file at line specified contains precisely?
    – Rarst
    Commented Nov 1, 2015 at 15:00
  • Oh, I checked the line the error was pointing to, it was on Chinese letter in a javascript comment, I didn't see it in the first place :)
    – Marox Tn
    Commented Nov 2, 2015 at 10:39

1 Answer 1

-1

in poeditor go to file->preferences->extractors->javascript->edit and change language JavaScript to php

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.