Skip to content

Commit

Permalink
Add Crowdin integration for translatio (#719)
Browse files Browse the repository at this point in the history
* Update composr.json

* Update .env

* Update services.yaml

* Update footer.html.twig

* Update translations.yaml

* Update README.md

* Update CONTRIBUTING.md

* Update translations

* Update composer.json

* Update translations
  • Loading branch information
jbelien authored Sep 17, 2022
1 parent 9e14538 commit f12199a
Show file tree
Hide file tree
Showing 25 changed files with 1,626 additions and 1,526 deletions.
4 changes: 4 additions & 0 deletions .env
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,7 @@ DATABASE_URL="sqlite:///%kernel.project_dir%/var/data.db"
# DATABASE_URL="mysql://db_user:[email protected]:3306/db_name?serverVersion=5.7"
# DATABASE_URL="postgresql://db_user:[email protected]:5432/db_name?serverVersion=13&charset=utf8"
###< doctrine/doctrine-bundle ###

###> symfony/crowdin-translation-provider ###
# CROWDIN_DSN=crowdin://PROJECT_ID:API_TOKEN@ORGANIZATION_DOMAIN.default
###< symfony/crowdin-translation-provider ###
12 changes: 5 additions & 7 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,15 @@

## Translation

**Your want to translate the tool in your own language ?**
[![Crowdin](https://badges.crowdin.net/osm-welcome-tool/localized.svg)](https://crowdin.com/project/osm-welcome-tool)

All translations are stored here: <https://github.com/osmbe/osm-welcome-tool/tree/2.x/translations>
**You want to add a new language ?**

To add a new language, copy the [`messages+intl-icu.en.xlf` file](https://github.com/osmbe/osm-welcome-tool/blob/2.x/translations/messages%2Bintl-icu.en.xlf) and update all the `target` properties to the correct translation in your language.
Request a new language by creating a new issue ; the translation is managed via [Crowdin](https://crowdin.com/), once the language is added to Crowndin, you'll be able to translate it here: <https://crowdin.com/project/osm-welcome-tool>

You don't need to provide translations of `security.en.xlf` and `validators.en.xlf` as these are part of the Symfony framework.
**You want to contribute to the translation of the tool in your own language ?**

Once done, save your file as `messages+intl-icu.##.xlf` by replacing `##` by the [ISO 639-1 language code](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) of your language.

Upload your new file to our [`translations/`](https://github.com/osmbe/osm-welcome-tool/tree/2.x/translations) folder and create a Pull Request, we'll take it from there!
Translation is managed via [Crowdin](https://crowdin.com/), go to <https://crowdin.com/project/osm-welcome-tool> to contribute!

---

Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# OpenStreetMap Welcome Tool

[![Crowdin](https://badges.crowdin.net/osm-welcome-tool/localized.svg)](https://crowdin.com/project/osm-welcome-tool)

Website to help welcoming new OpenStreetMap contributors in your region.

It detects new mappers in various regions and suggests a welcome message (based on templates) that you can then send to the mapper.
Expand Down
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@
"phpunit/phpunit": "^9.5",
"pluswerk/grumphp-xliff-task": "^5.0",
"symfony/browser-kit": "^6.0",
"symfony/crowdin-translation-provider": "^6.0",
"symfony/css-selector": "^6.0",
"symfony/debug-bundle": "^6.0",
"symfony/maker-bundle": "^1.0",
Expand Down
92 changes: 85 additions & 7 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 5 additions & 3 deletions config/packages/translation.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@ framework:
default_path: '%kernel.project_dir%/translations'
fallbacks:
- en
# providers:
# crowdin:
# dsn: '%env(CROWDIN_DSN)%'
providers:
crowdin:
dsn: '%env(CROWDIN_DSN)%'
domains: ['messages']
locales: '%app.locales%'
# loco:
# dsn: '%env(LOCO_DSN)%'
# lokalise:
Expand Down
2 changes: 1 addition & 1 deletion config/services.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ parameters:
osmcha.api.url: 'https://osmcha.org/api/v1/'
osmcha.api.key: '%env(OSMCHA_API_KEY)%'
osm.api.url: 'https://api.openstreetmap.org/api/0.6/'
app.locales: en|fr|it|nl|bg|es|ja|pl|de|sq|zh_TW|zh_CN
app.locales: ['en','fr','it','nl','bg','es_ES','ja','pl','de','sq','zh_TW','zh_CN']
app.userAgent: 'OpenStreetMap Welcome Tool'
app.title: 'OpenStreetMap Welcome Tool'

Expand Down
9 changes: 9 additions & 0 deletions symfony.lock
Original file line number Diff line number Diff line change
Expand Up @@ -417,6 +417,15 @@
"bin/console"
]
},
"symfony/crowdin-translation-provider": {
"version": "6.0",
"recipe": {
"repo": "github.com/symfony/recipes",
"branch": "main",
"version": "5.3",
"ref": "8acdcff2acee247e79f16ed0b2abc8fd53cf0d30"
}
},
"symfony/css-selector": {
"version": "v6.0.2"
},
Expand Down
2 changes: 1 addition & 1 deletion templates/app/footer.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
<div class="flex justify-between">
<div class="divide-solid">
{% for locale in (welcome.locales|split('|')) %}
{% for locale in welcome.locales %}
{% if loop.index0 > 0 %} &bull; {% endif %}
<a href="?l={{ locale }}">{{ locale|locale_name(locale)|capitalize }}</a>
{% endfor %}
Expand Down
Loading

0 comments on commit f12199a

Please sign in to comment.