WordPress.org

Ready to get started?Download WordPress

Forums

Codestyling Localization
[resolved] Keep translations after plugin update (8 posts)

  1. jmzolezzi
    Member
    Posted 2 years ago #

    I'm sure this has been asked before but I've been searching for a solution without success.

    Does anyone know how to keep plugin translations after we update them?

    I'm tired of having to manually download the .po file, update the plugins and later reupload it.

    http://wordpress.org/extend/plugins/codestyling-localization/

  2. daveshine (David Decker)
    Member
    Posted 2 years ago #

    Currently there's now way of doing that out of the box! As long as a plugin package from WordPress.org contains your desired language file than it will be overridden on automatic plugin updates!

    Only, if a plugin supports alternate folders for hosting the translation files, for example in "/wp-content/languages/" (or in a subfolder named like the plugin there...), then you're update secure.

    You can only do manual updates or just re-upload translations or beg the plugin's author to integrate alternate translations locations.

    Maybe the whole process changes in the future as WordPress might go towards "language packs" -- but no one of us knows yet how this will work in detail. Maybe, it will also be changed that plugin languages will be blocked from updates except for the admin of the site has this allowed or something like that. This option would be one of my faves :)

    This whole thing is definitely a field where WordPress could and REALLY SHOULD improve! Internationalization seems not on the focus of too much core devs...

    Hope this helps a bit, Dave :)

  3. codestyling
    Member
    Plugin Author

    Posted 2 years ago #

    I'm currently working on a draft spec how to solve this backup issue. It's not that easy to handle all for none programming related user.

  4. jorijnsmit
    Member
    Posted 1 year ago #

    For plugin developers see this article on how to make language files in your plugin folder backup proof.

    Basically you add this to your functions.php:

    public function load_plugin_textdomain()
    {
        $domain = 'my-plugin';
        // The "plugin_locale" filter is also used in load_plugin_textdomain()
        $locale = apply_filters('plugin_locale', get_locale(), $domain);
    
        load_textdomain($domain, WP_LANG_DIR.'/my-plugin/'.$domain.'-'.$locale.'.mo');
        load_plugin_textdomain($domain, FALSE, dirname(plugin_basename(__FILE__)).'/languages/');
    }

    This way your plugin will look for a language file in WP_LANG_DIR.'/my-plugin/ first before checking the 'local' language folder.

  5. codestyling
    Member
    Plugin Author

    Posted 1 year ago #

    The rewritten version 2.0 of CodeStyling Localization will contain 2 essential new things:

    1. Backup/Restore of Translation Files
    2. Maintainance of Translation files by re-routed folder to provide an overwrite safe way

    The 2nd point will also permit synchronizations as you want it and is also included within the full backup system.

  6. jorijnsmit
    Member
    Posted 1 year ago #

    Sounds amazing, when is it up for grabs?

    I couldn't find a repository for your plugin, is it available somewhere? Would be nice to develop it with you :-)!

  7. codestyling
    Member
    Plugin Author

    Posted 1 year ago #

    The new one plugin (2.0) only exists at my local development system.
    If all went the right way, it will be released at 01.01.2013 but will also have proconditions:
    - will not run with WordPress less than 3.4
    - will not run with PHP less than 5.1
    There is no longer backward compatibility, so the 1.x Versions will get frozen at this time an only get patches for a short time period.

  8. jmzolezzi
    Member
    Posted 1 year ago #

    That's great news!

    And I agree on focusing on new versions only and updated PHP installations.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic