• Hello Team,

    There are some pieces texts pre-translated in your .po files in my lanugage which I’d like to change. Because there are already existing .mo and .po of the language, I can’t seem it to override. I can of course replace the files in languages/plugins/ but after an update from your end it will overwrite my custom one. I know this can be done differently, but it’s not working, I tried the following set up:

    /wp-content/languages/easy-digital-downloads/
    /wp-content/languages/plugins/easy-digital-downloads/

    What is the correct way to do this for your plugin?

    With thanks,
    Demian

Viewing 9 replies - 1 through 9 (of 9 total)
  • Hi @demian85

    I suggest you yo put your new .mo file at this location wp-content/languages/plugins/easy-digital-downloads/

    This will work for you ??

    Thread Starter Demian

    (@demian85)

    Hi @pratik-jain

    I have had this issue before with WooCommerce, and if I am correct, your solution doesn’t work because, as I already mentioned, a future update from the plugin would overwrite the language files in the wp-content/languages/plugins/ location.

    This is also explained in your docs site from EDD.

    Please advise.

    Demian

    Ewout

    (@pomegranate)

    That is correct Demian, anything you change in the plugin folder will be overwritten by updates. There are two alternatives:

    1) Use the ‘custom’ folder as defined in the plugin (source): wp-content/languages/plugins/easy-digital-downloads/easy-digital-downloads-nl_NL.mo (for Dutch).
    2) Use the Loco Translate plugin which handles all that for you and stores the translation files separately in wp-content/languages/loco/plugins

    note that it is the .mo file that is used by wordpress, the .po file is only the source file used by editors.

    • This reply was modified 4 years, 9 months ago by Ewout. Reason: note about .po vs .mo
    Thread Starter Demian

    (@demian85)

    Hi @pomegranate

    Thanks for your reply. Please see my initial message, I have tried:

    wp-content/languages/plugins/easy-digital-downloads/

    But this is not working, I am not a fan of adding another plugin for a simple thing as language files. So I think something is wrong here.

    Ewout

    (@pomegranate)

    I just tested this and can confirm that this does not work as advertised ??

    It seems that WordPress automatically loads translations when the “Text Domain” and “Domain Path” are set in the readme, which is the case with EDD.

    This means that any translations present in the ‘official’ files will not be overriden by the custom files. One solution here would be to take the WooCommerce approach and make sure to unload the translations just before initiating the plugin translation loading process.

    I am just an EDD user like you, so there’s not much I can do to help here, but I think this is a bug that should be fixed ??

    As a temporary solution you could add this to your child theme functions.php:

    
    add_filter('plugin_locale', function( $plugin_locale, $textdomain ) {
    	if ($textdomain == 'easy-digital-downloads') {
    		unload_textdomain( 'easy-digital-downloads' );
    	}
    	return $plugin_locale;
    },999,2);
    

    Hi @demian85

    Thanks for your response. I think we have some confusion.

    Please refer below documentation for language
    https://docs.easydigitaldownloads.com/article/1023-easy-digital-downloads-in-your-own-language

    There is a note in that

    Note that we store the translation files outside of the plugin’s normal directory. This is so that when the plugin is updated, it doesn’t overwrite your custom translation files. The wp-content/languages/plugins/ directory is safe from updates while the wp-content/plugins directory is not.

    There are three translation path which plugin check and they have priority as given below

    // Look for wp-content/languages/edd/easy-digital-downloads-{lang}_{country}.mo
    1) WP_LANG_DIR . '/edd/easy-digital-downloads-en_US.mo';
    
    // Look for wp-content/languages/edd/edd-{lang}_{country}.mo
    2) WP_LANG_DIR . '/edd/edd-en_US.mo';
    
    // Look in wp-content/languages/plugins/easy-digital-downloads
    3) WP_LANG_DIR . '/plugins/easy-digital-downloads/easy-digital-downloads-en_US.mo';

    As per my point of view the path wp-content/languages/plugins/easy-digital-downloads/ does not work for you may be because of file name. Can you please verify the file name is same as given in third priority.

    Please verify the exact language code en_US.

    I hope this will work for you ??

    • This reply was modified 4 years, 9 months ago by Pratik Jain.
    Thread Starter Demian

    (@demian85)

    Hi @pratik-jain

    I just took the original .po and .mo files from the server. This is how I uploaded it:

    In fairness I am an advanced user, so if I made a basic mistake here, please let me know, as it means I am sleeping ??

    Also please check it for yourself, like @pomegranate did. You will notice something is not right here.

    Demian

    • This reply was modified 4 years, 9 months ago by Demian.
    Ewout

    (@pomegranate)

    Thread Starter Demian

    (@demian85)

    Thanks @pomegranate I am following it!

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Change – override existing translations’ is closed to new replies.