Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add V3 to main #17

Open
wants to merge 70 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
70 commits
Select commit Hold shift + click to select a range
a1faf47
[WIP] Integration v2
georgringer Nov 27, 2020
103121b
[TASK] Migrate status and build commands
georgringer Nov 27, 2020
80bf127
[TASK] Final migration?
georgringer Nov 29, 2020
39a3881
[TASK] Simplify setup command & remove dead code
georgringer Dec 2, 2020
eab3df5
[TASK] Start migrating extracting commands
georgringer Dec 2, 2020
d5bd736
[TASK] Improve visual output
georgringer Dec 4, 2020
c9212c9
[TASK] Update deps
georgringer Dec 4, 2020
7946271
[BUGFIX] Make it run on github
georgringer Dec 4, 2020
f971a2e
f
georgringer Dec 4, 2020
3441f65
[BUGFIX] Better check for empty files
georgringer Dec 4, 2020
559c3c0
[TASK] Disable cleanup
georgringer Dec 4, 2020
9399d3e
change rsync dir
georgringer Dec 4, 2020
cfdd4cd
[TASK] Enable crons
georgringer Dec 5, 2020
bf02f8e
[TASK] Improve integration
georgringer Dec 7, 2020
df54c26
[FEATURE] Provide cached wrapper for all languages
georgringer Dec 7, 2020
ff57587
[BUGFIX] Proper access to variables
georgringer Dec 7, 2020
49dfda2
[TASK] Improve status.html
georgringer Dec 7, 2020
f5ec060
[BUGFIX] Remove limit for translation progress
georgringer Dec 7, 2020
210b500
[TASK] Sort projects by its identifier
georgringer Dec 8, 2020
b74fa1d
[TASK] Remove check action
georgringer Dec 9, 2020
66d85c3
[TASK] Simplify extract run command
georgringer Dec 9, 2020
2f1b9e4
Merge branch 'v2' of github.com:TYPO3/crowdin-bridge into v2
georgringer Dec 9, 2020
68b3c7a
[TASK] Add univere header
georgringer Dec 9, 2020
352c70a
[BUGFIX] Improve language handling for extensions
georgringer Dec 15, 2020
404b9f7
[DOCS] Apply MD CGL
gilbertsoft Dec 19, 2020
cf1c7b0
[TASK] Support for 11.0
georgringer Jan 11, 2021
b38f7c4
Update Readme.md
georgringer Jun 15, 2021
b7d803b
[BUGFIX] Export multi locale languages again
georgringer Aug 17, 2021
8d9aec9
Delete todo.md
georgringer Aug 17, 2021
ad1bfcd
[BUGFIX] Respace multi locale for core
georgringer Aug 18, 2021
727fe91
[BUGFIX] Use normalized name for zips
georgringer Aug 18, 2021
78574c4
[BUGFIX] Handle all branch names
georgringer Feb 21, 2022
28352c8
[TASK] Add workflow_dispatch
georgringer Apr 29, 2022
a9e0769
[BUGFIX] Transform master to main
georgringer Jun 14, 2022
e84f446
[TASK] Add 11.5 branch and restore core main (v12) support
sbuerk Jun 16, 2022
a90f8eb
Merge pull request #5 from sbuerk/restore-main-support-1
georgringer Oct 4, 2022
35397f0
Merge pull request #2 from gilbertsoft/task/md-cgl
georgringer Oct 4, 2022
3136523
[TASK] add ext:reactions
josefglatz Feb 3, 2023
e6e0c16
Merge pull request #7 from josefglatz/patch-2
georgringer Feb 3, 2023
e3774ec
[TASK] Add support for `ext:webhooks`
sbuerk Mar 28, 2023
20bd337
Merge pull request #8 from sbuerk/sysext-webhooks
georgringer Mar 28, 2023
108c892
[TASK] Use scp-version
georgringer Apr 19, 2023
e4e6c53
[TASK] Avoid using env in scp copy
georgringer Apr 19, 2023
7baaded
[TASK] Align with recent 12.4 branch split
sbuerk Jun 6, 2023
10f1f46
Merge pull request #9 from sbuerk/stefan-1
bmack Jun 6, 2023
43d854c
[TASK] Upgrade the git checkout GitHub Action
oliverklee Jan 10, 2024
7bba509
Merge pull request #10 from oliverklee/task/update-checkout-action
bmack Jan 11, 2024
61051a6
[TASK] Cleanup + Change min dependencies
georgringer Jun 10, 2024
e8c8f49
[BUGFIX] Catch error during ext build command
georgringer Jun 10, 2024
25af46d
[TASK] Cleanup
georgringer Jun 10, 2024
c915dda
[TASK] Finish ext project
georgringer Jun 10, 2024
f61fe03
[TASK] Improve core creation
georgringer Jun 11, 2024
5dfe4b0
[TASK] Switch to a real symfony application
georgringer Jun 11, 2024
6619f33
[TASK] Disable v3 gh actions
georgringer Jun 11, 2024
371f0a4
[TASK] Further cleanup
georgringer Jun 11, 2024
d5984b8
[TASK] Improve code base
georgringer Jun 11, 2024
b5f4b08
[TASK] Add csfixer
georgringer Jun 11, 2024
64182f0
[FEATURE] Add progress bar to meta commands
georgringer Jun 11, 2024
5a5f669
[TASK] Remove meta commands
georgringer Jun 12, 2024
0f98cb5
[TASK] Rename commands
georgringer Jun 13, 2024
8521662
[TASK] Improve code quality
georgringer Jun 13, 2024
8894b15
[TASK] Provide logging
georgringer Jun 13, 2024
1390c4b
[TASK] Better check for correct branch names
georgringer Jun 13, 2024
bf2ab23
[TASK] Correct extension download
georgringer Jun 13, 2024
e3002c8
[TASK] Skip bogus extensions
georgringer Jun 13, 2024
998f3c1
[TASK] Improve large file handling
georgringer Jun 13, 2024
c9c6988
[TASK] Finish steups
georgringer Jun 23, 2024
36868e6
[TASK] Move .env copy
georgringer Jun 23, 2024
fff654c
[TASK] Use correct name
georgringer Jun 23, 2024
8779262
[TASK] More logging
georgringer Jun 23, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .build/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
/php-cs-fixer.cache.php


78 changes: 78 additions & 0 deletions .build/php-cs-fixer.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
<?php

declare(strict_types=1);

if (PHP_SAPI !== 'cli') {
die('This script supports command line usage only. Please check your command.');
}

return (new \PhpCsFixer\Config())
->setParallelConfig(\PhpCsFixer\Runner\Parallel\ParallelConfigFactory::detect())
->setCacheFile(__DIR__ . '/php-cs-fixer.cache.php')
->setFinder(
(new PhpCsFixer\Finder())
->ignoreVCSIgnored(true)
->in(realpath(__DIR__ . '/../src'))
)
->setRiskyAllowed(true)
->setRules([
'@DoctrineAnnotation' => true,
// @todo: Switch to @PER-CS2.0 once php-cs-fixer's todo list is done: https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/7247
'@PER-CS1.0' => true,
'array_indentation' => true,
'array_syntax' => ['syntax' => 'short'],
'cast_spaces' => ['space' => 'none'],
// @todo: Can be dropped once we enable @PER-CS2.0
'concat_space' => ['spacing' => 'one'],
'declare_equal_normalize' => ['space' => 'none'],
'declare_parentheses' => true,
'dir_constant' => true,
// @todo: Can be dropped once we enable @PER-CS2.0
'function_declaration' => [
'closure_fn_spacing' => 'none',
],
'function_to_constant' => ['functions' => ['get_called_class', 'get_class', 'get_class_this', 'php_sapi_name', 'phpversion', 'pi']],
'type_declaration_spaces' => true,
'global_namespace_import' => ['import_classes' => false, 'import_constants' => false, 'import_functions' => false],
'list_syntax' => ['syntax' => 'short'],
// @todo: Can be dropped once we enable @PER-CS2.0
'method_argument_space' => true,
'modernize_strpos' => true,
'modernize_types_casting' => true,
'native_function_casing' => true,
'no_alias_functions' => true,
'no_blank_lines_after_phpdoc' => true,
'no_empty_phpdoc' => true,
'no_empty_statement' => true,
'no_extra_blank_lines' => true,
'no_leading_namespace_whitespace' => true,
'no_null_property_initialization' => true,
'no_short_bool_cast' => true,
'no_singleline_whitespace_before_semicolons' => true,
'no_superfluous_elseif' => true,
'no_trailing_comma_in_singleline' => true,
'no_unneeded_control_parentheses' => true,
'no_unused_imports' => true,
'no_useless_else' => true,
'no_useless_nullsafe_operator' => true,
'ordered_imports' => ['imports_order' => ['class', 'function', 'const'], 'sort_algorithm' => 'alpha'],
'php_unit_construct' => ['assertions' => ['assertEquals', 'assertSame', 'assertNotEquals', 'assertNotSame']],
'php_unit_mock_short_will_return' => true,
'php_unit_test_case_static_method_calls' => ['call_type' => 'self'],
'phpdoc_no_access' => true,
'phpdoc_no_empty_return' => true,
'phpdoc_no_package' => true,
'phpdoc_scalar' => true,
'phpdoc_trim' => true,
'phpdoc_types' => true,
'phpdoc_types_order' => ['null_adjustment' => 'always_last', 'sort_algorithm' => 'none'],
'return_type_declaration' => ['space_before' => 'none'],
'single_quote' => true,
'single_space_around_construct' => true,
'single_line_comment_style' => ['comment_types' => ['hash']],
// @todo: Can be dropped once we enable @PER-CS2.0
'single_line_empty_body' => true,
'trailing_comma_in_multiline' => ['elements' => ['arrays']],
'whitespace_after_comma_in_array' => ['ensure_single_space' => true],
'yoda_style' => ['equal' => false, 'identical' => false, 'less_and_greater' => false],
]);
4 changes: 4 additions & 0 deletions .env.ci
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
APP_ENV=dev
APP_SECRET=306ba135abb836aba3e15536f8e77e48
###< symfony/framework-bundle ###
CROWDIN_ACCESS_TOKEN=
36 changes: 22 additions & 14 deletions .github/workflows/crowdin-build.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
name: Crowdin Build

on:
workflow_dispatch:
push:
branches:
- v3
schedule:
- cron: '0 */2 * * *'
jobs:
Expand All @@ -11,23 +14,28 @@ jobs:
strategy:
fail-fast: true
matrix:
php: ['7.3']
php: ['8.3']
steps:
- uses: actions/checkout@v1
- name: Set up PHP Version
run: |
sudo update-alternatives --set php /usr/bin/php${{ matrix.php }}
php -v
- uses: actions/checkout@v4

- name: Install dependencies
run: composer install --no-progress --no-suggest
- name: Setup PHP with composer v2
uses: shivammathur/setup-php@v2
with:
php-version: '8.3'
tools: composer:v2

- name: Get configuration
- name: Install dependencies
run: |
wget ${{ secrets.CONFIGURATION_URL }}
cp .env.ci .env
composer install --no-progress

- name: Build all projects
run: php app.php crowdin:meta:build
- name: Generate configuration
env:
CROWDIN_ACCESS_TOKEN: ${{ secrets.CROWDIN_ACCESS_TOKEN }}
run: |
php ./bin/console app:setup

- name: Cleanup
run: rm -rf configuration.json
# - name: Build all projects
# env:
# CROWDIN_ACCESS_TOKEN: ${{ secrets.CROWDIN_ACCESS_TOKEN }}
# run: ./bin/console app:build
59 changes: 34 additions & 25 deletions .github/workflows/crowdin-extract.yml
Original file line number Diff line number Diff line change
@@ -1,52 +1,61 @@
name: Crowdin Extract

on:
workflow_dispatch:
push:
branches:
- v3
schedule:
- cron: '30 1,3,5,7,9,11,13,15,17,19,21,23 * * *'
- cron: '30 */2 * * *'
jobs:
build:

runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix:
php: ['7.3']
php: ['8.3']
steps:
- uses: actions/checkout@v1
- name: Set up PHP Version
run: |
sudo update-alternatives --set php /usr/bin/php${{ matrix.php }}
php -v
- uses: actions/checkout@v4

- name: Setup PHP with composer v2
uses: shivammathur/setup-php@v2
with:
php-version: '8.3'
tools: composer:v2

- name: Install dependencies
run: composer install --no-progress --no-suggest
run: |
cp .env.ci .env
composer install --no-progress

- name: Get configuration
- name: Generate configuration
env:
CROWDIN_ACCESS_TOKEN: ${{ secrets.CROWDIN_ACCESS_TOKEN }}
run: |
wget ${{ secrets.CONFIGURATION_URL }}
php ./bin/console app:setup

- name: Extract translations
env:
CROWDIN_ACCESS_TOKEN: ${{ secrets.CROWDIN_ACCESS_TOKEN }}
run: |
php app.php crowdin:meta:extractExt
php app.php crowdin:extract:core '*'
php ./bin/console app:extract:extension
php ./bin/console app:extract:core

- name: Extract status
env:
CROWDIN_ACCESS_TOKEN: ${{ secrets.CROWDIN_ACCESS_TOKEN }}
run: |
php app.php crowdin:meta:status.export
php app.php crowdin:management:status ${{ secrets.CROWDIN_USER_KEY }} --export=1

- name: Cleanup
run: rm -rf configuration.json
php ./bin/console app:status:project
php ./bin/console app:status:overview

- name: Copy files to translation server
uses: appleboy/scp-action@master
env:
HOST: ${{ secrets.SCP_HOST }}
USERNAME: ${{ secrets.SCP_USERNAME }}
PORT: ${{ secrets.SCP_PORT }}
KEY: ${{ secrets.SSH_PRIVATE_KEY }}
uses: appleboy/scp-action@v0.1.4
with:
source: "/home/runner/work/crowdin-bridge/crowdin-bridge/public/rsync"
target: "/home/localize/www/export/"
host: ${{ secrets.SCP_HOST }}
username: ${{ secrets.SCP_USERNAME }}
port: ${{ secrets.SCP_PORT }}
key: ${{ secrets.SSH_PRIVATE_KEY }}
source: "export/rsync"
target: "/home/localize/www/export_v3/"

18 changes: 17 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,21 @@
/configuration.json
/configuration2.json
/configuration_old.json
/vendor
/keys
/bin
/bin/*
!/bin/console
/export/
.env
.env.dev
/backup
.DS_Store
.ddev
.idea
public/.DS_Store
/var

###> friendsofphp/php-cs-fixer ###
/.php-cs-fixer.php
/.php-cs-fixer.cache
###< friendsofphp/php-cs-fixer ###
116 changes: 2 additions & 114 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,119 +9,7 @@ The purpose is to download translations from Crowdin and copy those to the trans
## Setup

Run `composer install` to install the package.
After that, copy the configuration example file `examples/configuration.json` one level up and setup the directories properly.

## Commands

The following commands are available:

### `crowdin:build`

This command triggers the build process of a project at Crowdin.
Updated translations are only after a build process available for downloads.

**Command**

`php app.php crowdin:build`

**Arguments**

- `project` *required*: Project identifier
- `branch` *optional*: Branch for building
- `async` *optional*: Set to true for not waiting for any feedback, useful if project is big


### `crowdin:extract:core`

Trigger the download of core translations. Always all branches are downloaded.

**Arguments**

- `language` *required*: Languages to download, use `'*'` for all languages of this project

**Example**

`php app.php crowdin:extract:core '*'`

### `crowdin:extract:ext`

Download of extension translations. Always all languages are downloaded.

**Arguments**

- `project` *required*: Project identifier
- `language` *required*: Languages to download, use `'*'` for all languages of this project

**Example**

`php app.php crowdin:extract:ext typo3-extension-news de`

### `crowdin:api:add`

Add new project to configuration

**Arguments**

- `project` *required*: Project identifier
- `key` *required*: API key
- `extensionKey` *required*: Extension key

**Command**

`php app.php crowdin:api:add typo3-extension-rxshariff 12345678 rx_shariff`

### `crowdin:status`

Show status of a project

**Arguments**

- `project` *required*: Project identifier

**Command**

`php app.php crowdin:status typo3-extension-news`

### `crowdin:status.export`

Export simplified status of a project as json file to the same directory as translations.

**Arguments**

- `project` *required*: Project identifier

**Command**

`php app.php crowdin:status.export typo3-extension-news`

### Meta commands

The following meta commands group the subcommands together and makes it easier for automatic builds:

- `crowdin:meta:build`: Trigger build all projects
- `crowdin:meta:extractExt`: Download translations of all extensions
- `crowdin:meta:status.export`: Export status of all extensions

## Github Actions

The export runs automatically and uses GitHub Actions. The following workflows are available

### Workflows

- *Crowdin Build*: The build triggers the build process of all Crowdin projects.
- *Crowdin Extract*: Trigger export of translations of core + extensions and the translation status

### Secrets

The following secrets are required:

- `CONFIGURATION_URL`: URL to the configuration.json
- `SCP_HOST`: SSH Host info
- `SCP_USERNAME`: SSH user info
- `SCP_PORT`: SSH port info
- `SSH_PRIVATE_KEY`: SSH private key
- `CROWDIN_USER_KEY`: Access key for Crowdin Account



## Further docs

Checkout the `docs` directory for detailed information.
18 changes: 0 additions & 18 deletions app.php

This file was deleted.

Loading