Support » Plugin: Loco Translate » Translating Core Multisite Files

  • Resolved woodwardmatt

    (@woodwardmatt)


    Objective: To change some of the core admin text labels to provide a better context for users of our wordpress multisite instance.

    Example: On the Users > Add screen change: “Enter the email address or username of an existing user on this network to invite them to this site. That person will be sent an email asking them to confirm the invite.” to “Enter the email address or username of an existing <Product Name> user on invite them to this site. That person will be sent an email asking them to confirm the invite.”

    What I’ve tried so far:

    – Within the Loco Translate plugin, I’ve copied the admin-en_AU.po (with all current translations) and created a new language keeping the same file name but storing this under the safe “loco” folder location. I’ve then updated the above phrase and saved the file. The translation didn’t occur.

    – I’ve then deleted the above and copied the admin-en_AU.po (with all current translations) in exactly the same manner, but set the new file to remember the original source as the template (in hope this will help me when the core language files are updated). I’ve then updated the above phrase and saved the file. The translation didn’t occur.

    Observations:

    – The mo / po files are created / updated fine on the file system (which tells me the files are being written to the server fine).
    – No translation of WordPress’ admin labels appeared to take place. Not sure if the customized language files are necessarily being loaded.

    Questions:

    – What is the recommended approach to implementing language file changes to the core wordpress bundles within a wordpress multisite environment? I’ve read through FAQ, docs, and previous support tickets but couldn’t see many references to making translations with the core wordpress bundles. Would really appreciate a little guidance to make sure I’m approaching this correctly.

    Thank you in advance! 🙂

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

    (@timwhitlock)

    Hi. Thanks for this. I have found a bug.

    Are you able to try the current development version? This should be fixed for core file loading: https://localise.biz/wordpress/plugin/developers

    For the record, the issue was unrelated to multisite. The bug stemmed from the fact the the “default” text domain is split into multiple files, and the custom loader was only allowing the first one through. I should have spotted this ages ago, but my tests were obviously insufficient in that they only tested one file at a time.

    Please let me know if this fixes your issue and whether it causes any new issues. I hope to get it live quickly if all is well.

    Thread Starter woodwardmatt

    (@woodwardmatt)

    Wow! Thanks for the quick response Tim, loving your work 🙂

    I’ve installed the development version manually, and checked out what’s going on. The changes from yesterday are now showing on the primary blog for the multisite environment, but don’t show in the subsites. (No other issues etc. spotted this far).

    I suspect this is because, our need is really to have the Loco-Translate plugin enabled for the main site (where we only can manage translations) but not activated on the subsites. In that way I wonder if a lightweight “Loader” type of plugin would be useful for subsites, where it will load in the translations available (using your loading rules) but not surface up the interface for managing the translations – in that way a loader-only plugin?

    To confirm this, I’ve then activated Loco-Translate on one of my subsites, and the translations appear as expected.

    An alternative, is just to hide the Loco-Translate menu option for all subsites of course. I can do that manually, but maybe an option in the settings could also be a solution for this (so that the admin menu is only available to super admins in the network, or on a specific blog id).

    Let me know your thoughts.

    Once again a huge thanks for your quick response, really value your assistance 🙂

    Plugin Author Tim W

    (@timwhitlock)

    A standalone helper plugin is a good idea. It would also run before all other plugins if it was placed in “mu-plugins” which would help with the problem of plugins that load their translations too early for Loco Translate to intercept.

    Regarding permissions. The plugin settings allow you to grant permission to specific roles on a per-site basis. However, it’s true that there is no “Network admin only” option. I’ll give that some thought.

    I’ll mark this as resolved for now, as the reported issue is fixed in the dev branch. I’ll post back later with a suggested mu-plugin loader.

    Plugin Author Tim W

    (@timwhitlock)

    I’ve updated the dev branch again with some permission changes.

    Previous behaviour was to always grant access to anyone with the “administrator” role. New behaviour allows network admins to override this and allow/deny access to administrators on a per site basis.

    Please try it out and let me know how it goes.

    Plugin Author Tim W

    (@timwhitlock)

    Also, I just had a stab at a standalone loader.
    https://gist.github.com/timwhitlock/a079bbf4f87eb4c44db87d270c7119c2

    I’m marking this as resolved for now.

    Thread Starter woodwardmatt

    (@woodwardmatt)

    Hey Tim, thanks soo much for your fast turnaround with this feedback.

    I’ve tested both approaches with the latest dev code. Both work without any issues, and suit different use cases very well.

    For me, the loco-loader approach is spot on as I would never want to delegate out the translation features to the subsites. I have placed the loco-loader.php directly in the mu-plugins folder and disabled the main plugin, and this continues the translations perfectly.

    The updated settings approach will work well for Multisite instances where perhaps the subsites contribute to the translations. One bit of feedback here, would be that an added bit of awesomeness would be to be able to override all network / subsite settings from the superadmins settings (maybe as a check box “Override Network Settings?”). So that if you didn’t want to go through sites one by one (if you had a load of sites) then the super admin could quickly turn on / off access easily.

    Once again thanks soo much for your quick responses and willingness to respond to these changes 🙂 Much obliged!

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Translating Core Multisite Files’ is closed to new replies.