Skip to content

Commit

Permalink
Add decouple language packs (#209)
Browse files Browse the repository at this point in the history
* Decoupled translations using `afragen/translations-updater` dependency  (#178)

Moved translations into separate repo and using git updater code to load translations off github repo translations. 
---------

Signed-off-by: Andy Fragen <[email protected]>

* Change textdomain from mixed case to lowercase (#191)

* update mixed case textdomain to lowercase of aspireupdate references
* rename `AspireUpdate` repository to `aspireupdate`
* change text domain header
* add composer script to more easily create POT file
* requires WP-CLI installed locally

Signed-off-by: Andy Fragen <[email protected]>

* update referenced to mixed case repository (#193)

* add GA to generate POT on tag/release (#196)

* run GA on push to `main` and feature branch (#197)

* update afragen/translations-updater with error caching/logging (#199)

* update afragen/translations-updater with error caching/logging

* fix return of false due to validation failure

* return WP_Error instead of false

* better error handling

* updates to afragen/translations-updater

* composer update

* update error log messaging

* update library

* Fix version number in POT workflow (#202)

* Set POT generation action version to `2.0`. (#204)

* Add write permissions to POT generation workflow. (#205)

* 💬 POT File Regenerated

---------

Signed-off-by: Andy Fragen <[email protected]>
Co-authored-by: Colin Stewart <[email protected]>
Co-authored-by: WordPress BOT <[email protected]>
  • Loading branch information
3 people authored Nov 28, 2024
1 parent 63dcbc5 commit f4326db
Show file tree
Hide file tree
Showing 44 changed files with 1,511 additions and 1,228 deletions.
19 changes: 9 additions & 10 deletions .github/ISSUE_TEMPLATE/BugReport.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ body:
default: 0
validations:
required: true

- type: dropdown
id: os
attributes:
Expand All @@ -50,7 +50,7 @@ body:
- Android
- Linux
- Other


- type: dropdown
id: browsers
Expand All @@ -70,19 +70,19 @@ body:
attributes:
label: 'WordPress'
description: 'The version of WordPress that your site uses.'

- type: input
id: php
attributes:
label: 'PHP'
description: 'The version of PHP your site runs on.'

- type: input
id: server
attributes:
label: 'Server'
description: 'The server your site runs on (apache, nginx, etc).'

- type: input
id: database
attributes:
Expand All @@ -94,19 +94,19 @@ body:
attributes:
label: 'Theme'
description: 'The currently active theme.'

- type: input
id: must_use_plugins
attributes:
label: 'Must-Use Plugins'
description: 'A list of Must-Use Plugins.'

- type: input
id: plugins
attributes:
label: 'Plugins'
description: 'A list of active plugins.'



- type: textarea
Expand Down Expand Up @@ -140,9 +140,8 @@ body:
id: terms
attributes:
label: Code of Conduct
description: By submitting this issue, you agree to follow the AspirePress [Code of Conduct](https://github.com/aspirepress/AspireUpdate?tab=coc-ov-file).
description: By submitting this issue, you agree to follow the AspirePress [Code of Conduct](https://github.com/aspirepress/aspireupdate?tab=coc-ov-file).

options:
- label: I agree to follow the Code of Conduct.
required: true

26 changes: 26 additions & 0 deletions .github/workflows/generate-pot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Generate POT

on:
push:
branches:
- main
- translations

jobs:
WP_POT_Generator:
if: github.repository == 'aspirepress/aspireupdate'
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@master
- name: WordPress POT Generator
uses: varunsridharan/[email protected]
with:
save_path: "./languages"
item_slug: "${{ github.event.repository.name }}"
domain: "${{ github.event.repository.name }}"
package_name: "${{ github.event.repository.name }}"
headers: '{"Report-Msgid-Bugs-To":"https://github.com/${{ github.event.repository.full_name }}/issues"}'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3 changes: 1 addition & 2 deletions .github/workflows/playground-blueprint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:

jobs:
update-blueprint:
if: github.repository == 'aspirepress/AspireUpdate'
if: github.repository == 'aspirepress/aspireupdate'
runs-on: ubuntu-latest
permissions:
contents: write
Expand Down Expand Up @@ -43,4 +43,3 @@ jobs:
fi
env:
name: ${{ env.name }}

5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,14 @@
# Files and folders related to build and test tools.
.phpunit.result.cache
/phpunit.xml
/vendor
/vendor/*
.cache/*
/tests/phpunit/cache
/tests/phpunit/coverage
.DS_Store

# Track placeholders so that empty directories stay in the repo.
!.gitkeep

# Decoupled translation updating.
!/vendor/afragen
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,9 @@ NOTE 2: Setting AP_REMOVE_UI to `true` removes the plugin user interface. This i

## WP Playgrounds Support

The AspireUpdate current build ('main' branch) can be [experimented with in the WP Playground environment](https://playground.wordpress.net/?blueprint-url=https://raw.githubusercontent.com/aspirepress/AspireUpdate/refs/heads/main/assets/playground/blueprint.json).
The AspireUpdate current build ('main' branch) can be [experimented with in the WP Playground environment](https://playground.wordpress.net/?blueprint-url=https://raw.githubusercontent.com/aspirepress/aspireupdate/refs/heads/main/assets/playground/blueprint.json).

The AspireUpdate stable build ('playground-ready' branch) can be [tested with in the WP Playground environment](https://playground.wordpress.net/?blueprint-url=https://raw.githubusercontent.com/aspirepress/AspireUpdate/refs/heads/playground-ready/assets/playground/blueprint.json).
The AspireUpdate stable build ('playground-ready' branch) can be [tested with in the WP Playground environment](https://playground.wordpress.net/?blueprint-url=https://raw.githubusercontent.com/aspirepress/aspireupdate/refs/heads/playground-ready/assets/playground/blueprint.json).

## Debug Logging

Expand Down
21 changes: 19 additions & 2 deletions aspire-update.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@
* Tested up to: 6.7
* License: GPLv2
* License URI: https://www.gnu.org/licenses/old-licenses/gpl-2.0.txt
* Text Domain: AspireUpdate
* Text Domain: aspireupdate
* Domain Path: /languages
* GitHub Plugin URI: https://github.com/aspirepress/AspireUpdate
* GitHub Plugin URI: https://github.com/aspirepress/aspireupdate
* Primary Branch: main
*/

Expand Down Expand Up @@ -58,3 +58,20 @@ function aspire_update_uninstall_hook() {
$admin_settings = AspireUpdate\Admin_Settings::get_instance();
$admin_settings->delete_all_settings();
}

// Load and start translations updater.
add_action( 'init', 'aspireupdate_init_translations' );
function aspireupdate_init_translations() {
require_once __DIR__ . '/vendor/afragen/autoloader/Autoloader.php';
new Fragen\Autoloader( [ 'Fragen\\Translations_Updater' => __DIR__ . '/vendor/afragen/translations-updater/src/Translations_Updater' ] );
$config = [
'git' => 'github',
'type' => 'plugin',
'slug' => 'aspireupdate',
'version' => AP_VERSION, // Current version of plugin|theme.
'languages' => 'https://github.com/aspirepress/aspireupdate-translations',
'branch' => 'main',
];

( new \Fragen\Translations_Updater\Init() )->run( $config );
}
36 changes: 20 additions & 16 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{

"name": "aspirepress/aspire-update",
"description": "Update plugins and themes for WordPress.",
"type": "wordpress-plugin",
Expand All @@ -10,25 +9,30 @@
}
],
"require": {
"php": ">=7.4.0"
"php": ">=7.4.0",
"afragen/autoloader": "dev-master",
"afragen/translations-updater": "^1"
},
"require-dev": {

"squizlabs/php_codesniffer": "3.10.3",
"wp-coding-standards/wpcs": "~3.1.0",
"squizlabs/php_codesniffer": "3.10.3",
"wp-coding-standards/wpcs": "~3.1.0",
"yoast/phpunit-polyfills": "^1.1.0"
},
"config": {
"allow-plugins": {
"dealerdirect/phpcodesniffer-composer-installer": true
}
},
"config": {
"allow-plugins": {
"dealerdirect/phpcodesniffer-composer-installer": true
}
},
"scripts": {
"format": "@php ./vendor/squizlabs/php_codesniffer/bin/phpcbf --report=summary,source",
"lint": "@php ./vendor/squizlabs/php_codesniffer/bin/phpcs --report=summary, source",
"test": [ "Composer\\Config::disableProcessTimeout", "@php ./vendor/phpunit/phpunit/phpunit" ],
"test:multisite": [ "Composer\\Config::disableProcessTimeout", "@php ./vendor/phpunit/phpunit/phpunit -c tests/phpunit/multisite.xml" ]
"format": "@php ./vendor/squizlabs/php_codesniffer/bin/phpcbf --report=summary,source",
"lint": "@php ./vendor/squizlabs/php_codesniffer/bin/phpcs --report=summary,source",
"test": [
"Composer\\Config::disableProcessTimeout",
"@php ./vendor/phpunit/phpunit/phpunit"
],
"test:multisite": [
"Composer\\Config::disableProcessTimeout",
"@php ./vendor/phpunit/phpunit/phpunit -c tests/multisite.xml"
]
}


}
Loading

0 comments on commit f4326db

Please sign in to comment.