• Resolved roycegracie

    (@roycegracie)


    hi, i have seen that you have a languages folder with no langs at the moment. only a anspress.pot file.

    if i with the language to be HEBREW, how will the file name should be like ?
    anspress-he_IL.po, anspress-he_IL.mo ?

    if possible, it would be great if you can add a .po file with the default file format in english to that folder so that others will be able to translate easaly.

    https://www.ads-software.com/plugins/anspress/

Viewing 12 replies - 1 through 12 (of 12 total)
  • Plugin Author Rahul Aryan

    (@nerdaryan)

    Not sure about it (Never worked on wordpress language system before), but I will look into it.

    Hi. I had the same problem but now it’s fixed. First, I wrote these few lines of code in the file anspress.php, located at the main folder of the plugin. Just put these lines at the begining of the file, just after of Domain Path:/languages */… This is the code that you need to put:

    /* Add localization support */
    
    function ap_localization_setup() {
    		load_plugin_textdomain('ap', false, dirname(plugin_basename(__FILE__)) . '/languages/');
    }
    add_action('after_setup_theme', 'ap_localization_setup');

    So when you finish, the file will look like this (theres no need to delete nothing, just insert the code above without move anything more):

    * License URI:       https://www.gnu.org/licenses/gpl-2.0.txt
     * Domain Path:       /languages
     */
    
    /* Add localization support */
    
    function ap_localization_setup() {
    		load_plugin_textdomain('ap', false, dirname(plugin_basename(__FILE__)) . '/languages/');
    }
    add_action('after_setup_theme', 'ap_localization_setup');
    
    // If this file is called directly, abort.
    if ( ! defined( 'WPINC' ) ) {
    	die;
    }

    Now! thats the first step, The second step is to create the .po and .mo files with “CodeStyling Localization” Plugin, You can find a tutorial about using this plugin, its easy..

    The last step! once you get the .mo and .po files, you need to rename them. The textdomain of the AnsPress is ap, so the files might be like this in your case:
    ap-he_IL.po and ap-he_IL.mo

    Thats all. Its works fine for me. example: mywebsite

    Plugin Author Rahul Aryan

    (@nerdaryan)

    Thanks for contribution.
    But I think this is already there in anspress.

    But there was a little mistake in that function.

     /**
     * Load the plugin text domain for translation.
     *
    * @since    1.0.0
    */
    public function load_plugin_textdomain() {
       $domain = $this->plugin_slug;
       $locale = apply_filters( 'plugin_locale', get_locale(), $domain );
       load_textdomain( $domain, trailingslashit( WP_LANG_DIR ) . $domain . '/' . $domain . '-' . $locale . '.mo' );
    
    }
    


    This

    $this->plugin_slug

    need to be
    ap

    and it will solve the issue. It is same as yours, just there is wrong domain in my code.

    Please check and confirm it, if you can.

    I cannot push fix now, cause I am working on user profile for anspress and things are half done.

    If you wish to contribute let me know.

    Thanks for your time.

    Excellent nerdaryan. Thats very usefull, thanks for your fast reply and adjustment

    Well I tried to do the translation just renaming the .mo and .po files like this ap-es_ES.mo and ap_es-ES.po (Spanish language), without add the lines of code that I wrote above and it didn’t work.. When I add the code again into the anspress.php the translation works again

    Plugin Author Rahul Aryan

    (@nerdaryan)

    Did you seen my code in asnpress-main.php ?

    Just change

    $this->plugin_slug to ap

    In

    load_plugin_textdomain()

    If not work, then add your codes to asnpress-main.php, and commit it.

    Work for me !
    1. I add pasionXentrenar’s piece of code in the beginning of my anspress.php file

    2. I change in load_plugin_textdomain() function from the includes/anspress-main.php file :
    // $domain = $this->plugin_slug;
    $domain = ap;

    3. With CodeStyling Localization I translated in French.

    Thanks to both of you.

    Hi pasionXentrenar,

    Didn’t you have problem with the ap_status_type() function in anspress-functions.php (the one which returns the Question Status : open, solved, closed, duplicate)
    Cause the status are hardcoded, real deep…. How did you manage ? Thank you

    Sorry, I didn’t know how to translate the questions status, you’re right, it’s a real deep thing, I think that only the author could find something to translate the 100% of the plugin, with a future update

    Right now I have some words in english that I don’t know yet how to translate them –> The question status, and: it is spam
    This question is effectively an advertisement with no disclosure. It is not useful or relevant, but promotional.

    Thank you for you fast reply !

    Status is the same in French, so it was easy.

    And for the Spam sentence, I just let SPAM. I didn’t explain what SPAM is which is the meaning of : This question is effectively an advertisement with no disclosure. It is not useful or relevant, but promotional.

    I think I will try another plugin. Thank you very much and good luck.

    Plugin Author Rahul Aryan

    (@nerdaryan)

    Hello guys,
    Good news is that from version 0.2.0 you can easily add or remove status, and set their colors too. From now status is Label

    See this screenshot of adding new labels
    https://i60.tinypic.com/28sv4v4.png

    And this is the shot of upcoming users profile:
    https://i57.tinypic.com/2iijpug.png

    Hoping people will love upcoming AnsPress ??

    Plugin Author Rahul Aryan

    (@nerdaryan)

    And
    For changing flag messages just go to anspress setting and then Misc tab, there you can edit and add more flag messages.

    But usefulness of flag is coming in 0.2.0 version, cuz now we have moderate list. Where you can manage flagged questions & answers.

    And if you loved my hard work, please do not forget to give 5 Star rating.

    cheers ??

Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘some help with language file’ is closed to new replies.