-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 28e8c88
Showing
12 changed files
with
274 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
name: analyse | ||
|
||
on: ['push', 'pull_request'] | ||
|
||
jobs: | ||
test: | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
fail-fast: true | ||
matrix: | ||
os: [ubuntu-latest] | ||
php: [8.3] | ||
laravel: [11.*] | ||
stability: [prefer-stable] | ||
include: | ||
- laravel: 11.* | ||
testbench: 9.* | ||
|
||
name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.stability }} - ${{ matrix.os }} | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup PHP | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: ${{ matrix.php }} | ||
extensions: dom, curl, libxml, mbstring, zip, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv, imagick, fileinfo | ||
coverage: none | ||
|
||
- name: Install dependencies | ||
run: | | ||
composer require "laravel/framework:${{ matrix.laravel }}" "orchestra/testbench:${{ matrix.testbench }}" --no-interaction --no-update | ||
composer update --${{ matrix.stability }} --prefer-dist --no-interaction | ||
- name: Analyse | ||
run: composer analyse |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
name: "Update Changelog" | ||
|
||
on: | ||
workflow_dispatch: | ||
release: | ||
types: [ published, edited, deleted ] | ||
|
||
jobs: | ||
generate: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
with: | ||
ref: ${{ github.event.release.target_commitish }} | ||
token: ${{ secrets.RAPIDEZ_ACTIONS_ACCOUNT_PAT }} | ||
|
||
- name: Generate changelog | ||
uses: justbetter/generate-changelogs-action@main | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
repository: ${{ github.repository }} | ||
sha: ${{ github.head_ref || github.ref_name }} | ||
|
||
- name: Commit CHANGELOG | ||
uses: stefanzweifel/git-auto-commit-action@v4 | ||
with: | ||
branch: ${{ github.event.release.target_commitish }} | ||
commit_message: Update CHANGELOG | ||
file_pattern: CHANGELOG.md |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
name: style | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
jobs: | ||
style: | ||
name: Style | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup PHP | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: 8.3 | ||
extensions: dom, curl, libxml, mbstring, zip, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv, imagick, fileinfo | ||
coverage: none | ||
|
||
- name: Install dependencies | ||
run: composer install | ||
|
||
- name: Style | ||
run: composer fix-style | ||
|
||
- name: Commit Changes | ||
uses: stefanzweifel/git-auto-commit-action@v4 | ||
with: | ||
commit_message: Fix styling changes |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
composer.lock | ||
node_modules | ||
vendor | ||
mix-manifest.json |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# WIP | ||
This addon is still a WIP. | ||
|
||
# Statamic Translation Management | ||
|
||
> Statamic Translation Management is a Statamic addon that allows you to add/edit translations. | ||
## Features | ||
|
||
This addon does: | ||
|
||
- Edit translations | ||
- Create translations | ||
|
||
## How to Install | ||
|
||
``` bash | ||
composer require justbetter/statamic-translation-management | ||
``` | ||
|
||
This addon makes use of [spatie/laravel-translation-loader](https://github.com/spatie/laravel-translation-loader), and has migrations. | ||
To publish and migrate, you can run: | ||
|
||
```bash | ||
php artisan vendor:publish --provider="Spatie\TranslationLoader\TranslationServiceProvider" --tag="migrations" | ||
php artisan migrate | ||
``` | ||
|
||
## How to Use | ||
|
||
This addon adds a "translations" menu item in the control panel through [Runway](https://github.com/statamic-rad-pack/runway). Here you can add/edit the translations. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
{ | ||
"name": "justbetter/statamic-translation-management", | ||
"autoload": { | ||
"psr-4": { | ||
"Justbetter\\StatamicTranslationManagement\\": "src" | ||
} | ||
}, | ||
"autoload-dev": { | ||
"psr-4": { | ||
"Justbetter\\StatamicTranslationManagement\\Tests\\": "tests" | ||
} | ||
}, | ||
"require": { | ||
"statamic/cms": "^5.0", | ||
"spatie/laravel-translation-loader": "^2.8", | ||
"statamic-rad-pack/runway": "^7.11" | ||
}, | ||
"require-dev": { | ||
"orchestra/testbench": "^9.0", | ||
"larastan/larastan": "^2.9", | ||
"phpstan/phpstan-mockery": "^1.1", | ||
"laravel/pint": "^1.18" | ||
}, | ||
"config": { | ||
"allow-plugins": { | ||
"pixelfear/composer-dist-plugin": true | ||
} | ||
}, | ||
"extra": { | ||
"statamic": { | ||
"name": "Statamic Translation Management", | ||
"description": "Statamic Translation Management addon" | ||
}, | ||
"laravel": { | ||
"providers": [ | ||
"Justbetter\\StatamicTranslationManagement\\ServiceProvider" | ||
] | ||
} | ||
}, | ||
"minimum-stability": "dev", | ||
"prefer-stable": true, | ||
"scripts": { | ||
"test": "phpunit", | ||
"analyse": "phpstan", | ||
"style": "pint --test", | ||
"quality": [ | ||
"@test", | ||
"@analyse", | ||
"@style" | ||
], | ||
"fix-style": "pint" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
includes: | ||
- ./vendor/larastan/larastan/extension.neon | ||
- ./vendor/phpstan/phpstan-mockery/extension.neon | ||
|
||
parameters: | ||
paths: | ||
- src | ||
- tests | ||
level: 8 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" backupGlobals="false" bootstrap="vendor/autoload.php" colors="true" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd" convertErrorsToExceptions="true" convertNoticesToExceptions="true" convertWarningsToExceptions="true" processIsolation="false" stopOnFailure="false" beStrictAboutTestsThatDoNotTestAnything="false"> | ||
<coverage/> | ||
<testsuites> | ||
<testsuite name="Test Suite"> | ||
<directory suffix="Test.php">./tests</directory> | ||
</testsuite> | ||
</testsuites> | ||
<php> | ||
<env name="APP_ENV" value="testing"/> | ||
<env name="APP_KEY" value="base64:ybcI9MKuhLnESRSuWDfnJQuohOXMBaynfbTC5Y5i1FE="/> | ||
<env name="BCRYPT_ROUNDS" value="4"/> | ||
<env name="CACHE_DRIVER" value="array"/> | ||
<!-- <env name="DB_CONNECTION" value="sqlite"/> --> | ||
<!-- <env name="DB_DATABASE" value=":memory:"/> --> | ||
<env name="MAIL_MAILER" value="array"/> | ||
<env name="QUEUE_CONNECTION" value="sync"/> | ||
<env name="SESSION_DRIVER" value="array"/> | ||
<env name="TELESCOPE_ENABLED" value="false"/> | ||
</php> | ||
</phpunit> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<?php | ||
|
||
namespace Justbetter\StatamicTranslationManagement\Models; | ||
|
||
use Spatie\TranslationLoader\LanguageLine as SpatieLanguageLine; | ||
use StatamicRadPack\Runway\Traits\HasRunwayResource; | ||
|
||
class LanguageLine extends SpatieLanguageLine | ||
{ | ||
use HasRunwayResource; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<?php | ||
|
||
namespace Justbetter\StatamicTranslationManagement; | ||
|
||
use Justbetter\StatamicTranslationManagement\Models\LanguageLine; | ||
use Spatie\TranslationLoader\TranslationServiceProvider; | ||
use Statamic\Providers\AddonServiceProvider; | ||
|
||
class ServiceProvider extends AddonServiceProvider | ||
{ | ||
public function register() | ||
{ | ||
$this->app->register(TranslationServiceProvider::class, true); | ||
} | ||
|
||
public function bootAddon(): void | ||
{ | ||
config(['runway.resources' => array_merge( | ||
[LanguageLine::class => [ | ||
'name' => 'Translations', | ||
]], | ||
config('runway.resources') ?? [] | ||
)]); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<?php | ||
|
||
namespace Justbetter\StatamicTranslationManagement\Tests; | ||
|
||
use Justbetter\StatamicTranslationManagement\ServiceProvider; | ||
use Statamic\Testing\AddonTestCase; | ||
|
||
abstract class TestCase extends AddonTestCase | ||
{ | ||
protected string $addonServiceProvider = ServiceProvider::class; | ||
|
||
protected function getPackageProviders($app) | ||
{ | ||
return [ | ||
...parent::getPackageProviders($app), | ||
\StatamicRadPack\Runway\ServiceProvider::class, | ||
]; | ||
} | ||
} |