pressbooks / ideas

Ideas for Pressbooks.
GNU General Public License v3.0
12 stars 4 forks source link

Automatically update translations for open source repos pre-release #283

Closed SteelWagstaff closed 2 years ago

SteelWagstaff commented 4 years ago

Transifex now supports automatic GitHub integration for individual repos: https://docs.transifex.com/transifex-github-integrations/github-tx-ui. We should test this for one of our repos currently using Transifex to see how it might improve our i18n & l10n processes. I propose our CAS SSO plugin for initial test.

Steel installed and connected Transifex app in organizational GitHub and authorized for 5 repos: pressbooks-publisher, pressbooks-aldine, pressbooks-lti-provider, pressbooks-cas-sso, pressbooks-saml-sso on 4.24.20

To proceed further we will need to choose a branch to work against (dev, master, etc.) and then map our repo in Transifex by producing a YAML file that matches their schema. See https://docs.transifex.com/integrations/transifex-github-integration#linking-a-specific-project-with-a-github-repository and https://docs.transifex.com/transifex-github-integrations/github-tx-ui#more-examples-of-yaml-configurations- (for examples) Screenshot from 2020-04-24 20-06-57

We can also choose to send localized content to GitHub manually: https://docs.transifex.com/transifex-github-integrations/github-tx-ui#manual-sync

Related idea: https://github.com/pressbooks/ideas/issues/253

Ned shared how we can create sample language file updates for a repo as part of a GitHub action (see recording below). We could use this method to test/verify proposed changes and then if satisfied with result, could accept a PR adding GitHub actions to automatically update language files whenever PRs are merged for selected repos:

https://user-images.githubusercontent.com/13485451/110682418-c1672180-818f-11eb-95fc-74cd25d88ea4.mp4

SteelWagstaff commented 4 years ago

Ned shared how he's doing this for his platform coop project: https://github.com/platform-coop-toolkit/coop-library/blob/dev/.github/workflows/main.yml https://github.com/platform-coop-toolkit/coop-library-framework/blob/dev/.github/workflows/main.yml

SteelWagstaff commented 3 years ago

Next steps:

SteelWagstaff commented 3 years ago

PRs for review: https://github.com/pressbooks/pressbooks-lti-provider/pull/123 https://github.com/pressbooks/pressbooks-saml-sso/pull/67 https://github.com/pressbooks/pressbooks-cas-sso/pull/51 https://github.com/pressbooks/pressbooks/pull/2140 https://github.com/pressbooks/pressbooks-book/pull/762 https://github.com/pressbooks/pressbooks-aldine/pull/236

ho-man-chan commented 3 years ago

@greatislander @SteelWagstaff I noticed the pull requests only create the .POT file and it does not update the .mo, or .po file described in the release process. Would that be needed?

https://github.com/pressbooks/private/wiki/Release-Process

If the plugin is localized, run the following command in the plugin directory from your development environment (note: requires pb-cli with Composer require-dev installed):

 wp pb make-pot . languages/<plugin>.pot --exclude="vendor,symbionts" --headers='{"Report-Msgid-Bugs-To":"https://github.com/pressbooks/<plugin>/"}'
If the plugin is localized:

Remove all the *.po and *.mo files from the languages/ folder.

Run the following command in the plugin directory (you need to have the Transifex client installed and configured for access; if you don't have a Transifex account, ask the product owner or the head of the development team):

bash bin/i18n.sh

📔 The minimum translation completion threshold required in order for a file to be downloaded is 25%
SteelWagstaff commented 3 years ago

@ho-man-chan These PRs that Ned has opened only deal with the POT files as a proof of concept. Once we review the artifacts these product and think they look good (i.e. set them to auto commit), Ned will open another set of PRs which take the same approach & auto update the .po and .mo files (first we will create artifacts for review, then we'll switch to auto commit once we feel good about it).

greatislander commented 3 years ago

Follow-up PRs:

SteelWagstaff commented 3 years ago

Pressbooks is now creating artifacts upon PRs. We'll want to improve context for translators wherever we use variables in translated strings. See https://gist.github.com/greatislander/5f7650f134b9643dae637d48fc3af9ef and https://codex.wordpress.org/I18n_for_WordPress_Developers#Descriptions (context: https://github.com/WordPress/WordPress-Coding-Standards/issues/423)

SteelWagstaff commented 3 years ago

Diff checker for artifacts look good: https://www.diffchecker.com/DCX8GDDQ!