Support » Plugin: Loco Translate » Possible to sync multiple languages in one pass?

  • Resolved Dave Boulden

    (@daveboulden)


    I am using Loco Translate with a plugin I am developing and currently have 14 languages being translated. When I add new strings into the plugin and then sync the POT file, I then have to visit each language edit page to sync and then save them. Is it possible to sync and save all languages in one go? If not, could we please have this feature added as it would be a big time saver.

Viewing 15 replies - 1 through 15 (of 18 total)
  • Plugin Author Tim W

    (@timwhitlock)

    Is it possible to sync and save all languages in one go?

    Not using the plugin as it is now, no. Sync is only provided via the editor, and so is only per file.

    could we please have this feature added

    It is being added as part of a larger feature which is currently in development.

    This feature will provide a new screen called “Jobs”. This will let you package multiple language files that you want manage as one chunk. It will have options to automatically sync, and also send off for automatic or human translation if required.

    This feature won’t be in the next release 2.4.4, but hopefully will make it into 2.5 some time after that.

    If you’re wondering why I don’t just add a global Sync button right now.. There are many themes and plugins that don’t ship a POT and which can’t be reliably extracted from source. This causes a lot of support requests when clicking Sync “doesn’t work”. I’m not inclined to scale that problem up to multiple files, so it requires a re-think and a bit more user-centric organisation.

    Dave Boulden

    (@daveboulden)

    That’s great, thanks Tim… and I’m not surprised by some of the logistical issues of adding overarching features such as this but always interested in knowing why. It’s very good to know it is in the pipeline for a later release.

    Plugin Author Tim W

    (@timwhitlock)

    Do you use the wp command line?

    Thinking out loud: It could be quite easy for me to bundle a script that does a global sync of all bundles that have valid templates. Using CLI would raise the bar for technical knowledge of people using the tool, hence less support overhead.

    Dave Boulden

    (@daveboulden)

    That would certainly work for me as a way of getting the functionality sooner. I haven’t used the CLI yet (though have used DRUSH, the equivalent for Drupal). This would be the perfect reason to give it a go.

    Plugin Author Tim W

    (@timwhitlock)

    Great. I’ve not used it much myself, but have been meaning to look at possible cli integrations. I’ll have a play with this and if workable have something in 2.4.4

    Dave Boulden

    (@daveboulden)

    I’ll keep my eyes peeled for the release.

    Plugin Author Tim W

    (@timwhitlock)

    Quick update to say that I didn’t have time to include this feature in the 2.4.4 release (which just went up).

    It’s still ear-marked for development and I’ll post back here once something is on the dev branch.

    That’s OK Tim, I’ll keep my eyes peeled on this thread for an update later.

    Plugin Author Tim W

    (@timwhitlock)

    Update:

    The Development branch has two cli commands added today (“extract” and “sync”). Run wp loco to see their arguments.

    I will document these at some point, but for now they are experimental. Make sure you back up your files before using.

    Also be aware that these commands only use direct file access at the moment (no FTP for example).

    As a side note, the PO merging (and Fuzzy matching) functionality in this CLI is new, because previously it ran inside the editor (JavaScript). I am going to move the editor sync to the new system when I’m happy with it.

    Feedback welcome on this.

    Dave Boulden

    (@daveboulden)

    Thanks Tim, I’ll give that a spin next week and give you some feedback.

    Plugin Author Tim W

    (@timwhitlock)

    The current commands are live in 2.4.5 and documented here:

    https://localise.biz/wordpress/plugin/manual/wpcli

    Dave Boulden

    (@daveboulden)

    I have updated to v2.4.5 and tried wp help loco.

    It produced some error output:

    [2020-11-19 18:56:46.567] ERR [util_exec] proc_close() failed ['/opt/psa/admin/bin/filemng' 'xxxxxx' 'exec' '/var/www/vhosts/xxxxxx.co.uk/xxxxx.xxxxxx.co.uk' 'timeout' '60' '/opt/plesk/php/7.4/bin/php' '-d' 'safe_mode=off' '-d' 'display_errors=off' '-d' 'opcache.enable_cli=off' '-d' 'open_basedir=' '-d' 'error_reporting=341' '-d' 'max_execution_time=60' '-c' '/var/www/vhosts/system/xxxxx.xxxxxx.co.uk/etc/php.ini' '/opt/psa/admin/plib/modules/wp-toolkit/vendor/wp-cli/wp-cli/php/boot-fs.php' '--path=/var/www/vhosts/xxxxxx.co.uk/xxxxx.xxxxxx.co.uk' '--no-color' 'help' 'loco'] with exit code [1]
    'loco' is not a registered wp command. See 'wp help' for available commands.
    exit status 3

    I have renamed the username and domain names in the file paths to ‘xxxxxx’ for privacy.

    Plugin Author Tim W

    (@timwhitlock)

    I’m afraid I’m completely new to WP-CLI. I can’t begin to guess at why your command doesn’t work and I’m confused at the convoluted execution command.

    I hook the commands in when my plugin starts up. That code is here. This worked first time when I installed it on my dev machine, but I’m running it as a .phar directly on the command line via the cli SAPI. (WP-CLI 2.4.0). Presumably you aren’t?

    Dave Boulden

    (@daveboulden)

    I had to set up a couple of aliases in my Bash profile to make use of the WP-CLI that is installed as part of the WP-Toolkit that Plesk uses to manage WP installs, so it is not a plain vanilla WP-CLI setup.

    I’ll try and do some debugging and possibly involve the team at Plesk if that is part of the issue as I notice there are also some deprecation errors (within the WP-toolkit code) in my error log when trying the wp loco commands:

    PHP Deprecated: implode(): Passing glue string after array is deprecated. Swap the parameters in /opt/psa/admin/plib/modules/wp-toolkit/vendor/wp-cli/wp-cli/php/WP_CLI/DocParser.php on line 75

    Plugin Author Tim W

    (@timwhitlock)

    As you point out, that error is from wp-cli. I think you have an old version. So upgrade to the latest for starters.

Viewing 15 replies - 1 through 15 (of 18 total)
  • You must be logged in to reply to this topic.