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

Use Symfony Translations to synchronize translations with Lokalise #1648

Merged
merged 23 commits into from
Oct 2, 2024
Merged
Show file tree
Hide file tree
Changes from 17 commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
f545b1c
upgrade existing symfony components to 6.4.x
osma Aug 14, 2024
d7e2970
install symfony console and its dependencies
osma Aug 14, 2024
db36d71
disable CI tests for PHP 8.0 (not supported by Symfony 6.4)
osma Aug 14, 2024
062ec91
configure Symfony Translations & rename po files to match Symfony exp…
osma Aug 14, 2024
5f77147
set up translation sync with Lokalise (instead of Transifex)
osma Aug 14, 2024
49980c1
pull newest translations from Lokalise
osma Aug 14, 2024
2d451e1
switch to JSON format for translations
osma Aug 14, 2024
41bf8a6
Merge branch 'main' into issue1527-translation-symfony
osma Aug 15, 2024
5729b79
Merge branch 'main' into issue1527-translation-symfony
osma Aug 20, 2024
d1403e9
set up message extraction from twig templates; use default domain 'me…
osma Aug 20, 2024
8fcb26b
add extra-msgids.twig that lists messages that need to be translated …
osma Aug 20, 2024
b68f508
rename .inc template files to .inc.twig to enable message extraction
osma Aug 20, 2024
cf94201
convert linkUrlFilter to a Twig extension class
osma Aug 20, 2024
50e684e
fix use of linkUrlFilter in RestController
osma Aug 20, 2024
e676960
Merge branch 'issue1653-twig-templates-into-their-own-classes' into i…
osma Aug 20, 2024
a906fb6
add twig/console dependency to enable debug:twig command
osma Aug 20, 2024
47338e6
allow autoconfiguring of LinkUrlExtension to enable message extractio…
osma Aug 20, 2024
d6001bc
Comment from the review: The new symfony dependencies are only needed…
miguelvaara Oct 1, 2024
0e49f02
adjustments after syncing with Lokalise
osma Oct 2, 2024
fa75b0b
Merge branch 'main' into issue1527-translation-symfony
osma Oct 2, 2024
420655f
drop .inc suffix (no longer used for twig templates)
osma Oct 2, 2024
57d5648
make symfony utilities dev dependencies as they are not needed at run…
osma Oct 2, 2024
ddb739c
re-pull translations from Lokalise to sort keys alphabetically
osma Oct 2, 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
19 changes: 19 additions & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# In all environments, the following files are loaded if they exist,
# the latter taking precedence over the former:
#
# * .env contains default values for the environment variables needed by the app
# * .env.local uncommitted file with local overrides
# * .env.$APP_ENV committed environment-specific defaults
# * .env.$APP_ENV.local uncommitted environment-specific overrides
#
# Real environment variables win over .env files.
#
# DO NOT DEFINE PRODUCTION SECRETS IN THIS FILE NOR IN ANY OTHER COMMITTED FILES.
# https://symfony.com/doc/current/configuration/secrets.html
#
# Run "composer dump-env prod" to compile .env files for production use (requires symfony/flex >=1.2).
# https://symfony.com/doc/current/best_practices.html#use-environment-variables-for-infrastructure-configuration

###> symfony/lokalise-translation-provider ###
LOKALISE_DSN=lokalise://8890111966276e3b27f4e6.81990707:f16b6220b0cc08467720f1b5a618e6cd2f5b033f@default
###< symfony/lokalise-translation-provider ###
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
strategy:
fail-fast: false
matrix:
php_version: ["8.0", "8.1", "8.2"]
php_version: ["8.1", "8.2"]
experimental: [false]

steps:
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,4 @@ tests/cypress/videos/
tests/cypress/screenshots/
/.idea
*.swp
var/
21 changes: 21 additions & 0 deletions bin/console
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/usr/bin/env php
<?php

use App\Kernel;
use Symfony\Bundle\FrameworkBundle\Console\Application;

if (!is_dir(dirname(__DIR__).'/vendor')) {
throw new LogicException('Dependencies are missing. Try running "composer install".');
}

if (!is_file(dirname(__DIR__).'/vendor/autoload_runtime.php')) {
throw new LogicException('Symfony Runtime is missing. Try running "composer require symfony/runtime".');
}

require_once dirname(__DIR__).'/vendor/autoload_runtime.php';

return function (array $context) {
$kernel = new Kernel($context['APP_ENV'], (bool) $context['APP_DEBUG']);

return new Application($kernel);
};
21 changes: 16 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,29 @@
"ext-mbstring": "*",
"ext-xsl": "*",
"monolog/monolog": "1.27.*",
"symfony/translation": "6.0.*",
"symfony/translation": "6.4.*",
"symfony/translation-contracts": "3.0.*",
"symfony/twig-bundle": "6.0.*",
"symfony/config": "6.0.*"
"symfony/twig-bundle": "6.4.*",
"symfony/config": "6.4.*",
osma marked this conversation as resolved.
Show resolved Hide resolved
"symfony/runtime": "6.4.*",
"symfony/framework-bundle": "6.4.*",
"symfony/yaml": "^6.4",
"symfony/dotenv": "6.4.*",
"symfony/lokalise-translation-provider": "6.4.*",
"symfony/console": "6.4.*"
},
"require-dev": {
"phpunit/phpunit": "9.5.*",
"symfony/dom-crawler": "5.4.*",
"symfony/dom-crawler": "6.4.*",
"mockery/mockery": "1.5.1",
"friendsofphp/php-cs-fixer": "3.16.*"
},
"autoload": {
"classmap": ["src/controller/", "src/model/", "src/model/sparql/"]
"classmap": ["src/", "src/controller/", "src/model/", "src/model/sparql/"]
},
"config": {
"allow-plugins": {
"symfony/runtime": true
}
}
}
6 changes: 6 additions & 0 deletions config/bundles.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?php

return [
Symfony\Bundle\FrameworkBundle\FrameworkBundle::class => ['all' => true],
Symfony\Bundle\TwigBundle\TwigBundle::class => ['all' => true],
];
3 changes: 3 additions & 0 deletions config/packages/framework.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# see https://symfony.com/doc/current/reference/configuration/framework.html
framework:
secret: '%env(APP_SECRET)%'
10 changes: 10 additions & 0 deletions config/packages/translation.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
framework:
default_locale: en
translator:
default_path: '%kernel.project_dir%/resource/translations'
fallbacks:
- en
providers:
lokalise:
dsn: '%env(LOKALISE_DSN)%'
locales: ['ar', 'da', 'de', 'en', 'es', 'fa', 'fi', 'fr', 'fy', 'it', 'lv', 'nb', 'nl', 'nn', 'pl', 'pt_BR', 'pt', 'ru', 'se', 'sv', 'zh']
4 changes: 4 additions & 0 deletions config/packages/twig.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
twig:
default_path: '%kernel.project_dir%/src/view'
file_name_pattern: ['*.twig', '*.inc']
osma marked this conversation as resolved.
Show resolved Hide resolved

18 changes: 18 additions & 0 deletions config/services.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# This file is the entry point to configure your own services.
# Files in the packages/ subdirectory configure your dependencies.

# Put parameters here that don't need to change on each machine where the app is deployed
# https://symfony.com/doc/current/best_practices.html#use-parameters-for-application-configuration
parameters:

services:
# default configuration for services in *this* file
_defaults:
autowire: true # Automatically injects dependencies in your services.
autoconfigure: true # Automatically registers your services as commands, event subscribers, etc.

# add more service definitions when explicit configuration is needed
# please note that last definitions always *replace* previous ones
LinkUrlExtension:
class: 'LinkUrlExtension'
public: true
40 changes: 0 additions & 40 deletions resource/translations/fetch-from-transifex

This file was deleted.

Loading
Loading