Weblate translation provider for Symfony Translation.

Overview

Weblate Translation Provider

Author Software License


This bundle provides a Weblate integration for Symfony Translation.

Installation

composer require m2mtech/weblate-translation-provider

If you are not using Flex enable the bundle:

// config/bundles.php

return [
    // ...
    M2MTech\WeblateTranslationProvider\WeblateTranslationProviderBundle::class => ['all' => true],
];

Enable the translation provider:

# config/packages/translation.yaml
framework:
    translator:
        providers:
            weblate:
                dsn: '%env(WEBLATE_DSN)%'
                locales: ['en', 'de']

and set the DSN in your .env file:

# .env
WEBLATE_DSN=weblate://PROJECT_NAME:API_TOKEN@WEBLATE_URL

If you are using a local weblate instance, you can disable the usage of https and/or the verification of the used certificate:

# config/packages/weblate.yaml
weblate_translation_provider:
    https: false
    verify_peer: false

Usage

bin/console translation:push [options] weblate
bin/console translation:pull [options] weblate

Testing

This package has been developed for php 7.4 with compatibility tested for php 7.2 to 8.1.

composer test

For compatibility tests with Symfony 5.3 to 6.0 including a local weblate instance please use the symfony-weblate-tests package.

Changelog

Please see CHANGELOG for more information about recent changes.

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

The MIT License (MIT). Please see License File for more information.

Comments
  • Considering inclusion in Symfony?

    Considering inclusion in Symfony?

    Would you consider the idea of adding the Weblate Translation Provider into Symfony core? It could be listed in https://symfony.com/doc/current/translation.html#translation-providers, and benefit of the backward compatibility of Symfony.

    I'll be happy to discuss it if you want :wink:

    opened by welcoMattic 3
  • "https" is not used as the default

    When pushing translations, I run into this odd bug with a self-hosted Weblate instance. I spent some time debugging it myself and then also asked the question here: https://stackoverflow.com/questions/73389431/symfony-weblate-eror-when-pushing-component-translations

    The documentation suggests that the default configuration uses https to connect to Weblate, which can be set to false (Source: https://github.com/m2mtech/weblate-translation-provider/blob/main/README.md?plain=1#L46).

    But when looking at the requests that are made during pushing, some of them are made using http and get redirected by Weblate (or a proxy?) with status code 308. The redirect also drops the trailing slash at the end (e.g. messages/translations/ -> messages/translations).

    It's probably something that could also be fixed on the proxy- or Weblate-side, but it would be nice if the package could handle this too. I made a rather crude patch, which I will submit, but there is probably a better solution.

    opened by tobias47n9e 3
  • Documentation: How to set source-language other than English

    Documentation: How to set source-language other than English

    When pushing translations to a new project using this config:

    framework:
        default_locale: '%locale%'
        translator:
            providers:
                weblate:
                    dsn: '%env(WEBLATE_DSN)%'
                    locales: ['de', 'fr', 'it']
    

    and in services.yaml:

    parameters:
        locale: 'de'
    

    and in my translations folder I have 3 files:

    messages.de.yml
    messages.fr.yml
    messages.it.yml
    

    and this command:

    bin/console translation:push --domains=messages weblate
    

    I get this result (after starting a translation project for Italian):

    image

    Would it be possible to document how to push e.g. "de" as the source-language? Sorry if this falls under support, rather than bug report.

    opened by tobias47n9e 2
  • Not compatible with Symfony v6.1.3?

    Not compatible with Symfony v6.1.3?

    After following the installation guide with a Symfony 6.1 project, I seem to be getting an error from the config. My config is

    framework:
        translator:
            providers:
                weblate:
                    dsn: '%env(WEBLATE_DSN)%'
                    locales: ['en', 'de']
    

    When calling bin/console translation:push the following error is printed:

    The "weblate" scheme is not supported.

    Is there perhaps an incompatibility with Symfony 6.1?

    opened by JainJayan 2
  • Add path from DSN to the API http client

    Add path from DSN to the API http client

    Hello, First of all thank you for your work! I open the PR because in our setup at Pilcrow we have multiple instances in subdirectories and so the DSN must include the path to work. I think it's a legit change to have anyway. Let me know

    opened by pushull 1
Releases(v1.2.0)
Owner
Martin Mandl
Martin Mandl
[virion] Language management library for automatic translation

libtranslator :: library for automatic translation ✔️ Multilingual support for plugin messages ✔️ Translation language is set according to the player

PocketMine-MP projects of PresentKim 5 Jul 29, 2022
Laravel translation made __('simple').

Translation.io client for Laravel 5.5+/6/7/8 Add this package to localize your Laravel application. Use the official Laravel syntax (with PHP or JSON

Translation.io 109 Dec 29, 2022
🎌 Laravel Localization Helper :: Easily add translation variables from Blade templates.

LocalizationHelper Package for convenient work with Laravel's localization features and fast language files generation. Take a look at contributing.md

Awes.io 36 Jul 18, 2022
Manage Laravel translation files

Laravel 5 Translation Manager For Laravel 4, please use the 0.1 branch! This is a package to manage Laravel translation files. It does not replace the

Barry vd. Heuvel 1.5k Jan 4, 2023
A GUI for managing JSON translation files in your laravel projects.

Laravel Language Manager Langman is a GUI for managing your JSON language files in a Laravel project. Installation Begin by installing the package thr

Mohamed Said 515 Nov 30, 2022
A Gui To Manage Laravel Translation Files

Lingo A file based translation manager, which unlike other Lang managers don't need a database connection to handle the translation. Installation comp

Muah 97 Dec 5, 2022
Provides support for message translation and localization for dates and numbers.

The I18n library provides a I18n service locator that can be used for setting the current locale, building translation bundles and translating messages. Additionally, it provides the Time and Number classes which can be used to output dates, currencies and any numbers in the right format for the specified locale.

CakePHP 26 Oct 22, 2022
Internationalization tools, particularly message translation.

Aura.Intl The Aura.Intl package provides internationalization (I18N) tools, specifically package-oriented per-locale message translation. Installation

Aura for PHP 86 Dec 18, 2022
The Translation component provides tools to internationalize your application.

Translation Component The Translation component provides tools to internationalize your application. Getting Started $ composer require symfony/transl

Symfony 6.4k Jan 6, 2023
Filament Translations - Manage your translation with DB and cache

Filament Translations Manage your translation with DB and cache, you can scan your languages tags like trans(), __(), and get the string inside and tr

Fady Mondy 32 Nov 28, 2022
Official PHP library for the DeepL language translation API.

deepl-php Official PHP client library for the DeepL API. The DeepL API is a language translation API that allows other computer programs to send texts

DeepL 78 Dec 23, 2022
French-Traduction-Pterodactyl est la traduction française de pterodactyl French-Traduction-Pterodactyl is the French translation of pterodactyl

French-Traduction-Pterodactyl Star French-Traduction-Pterodactyl est la traduction française de pterodactyl French-Traduction-Pterodactyl is the Frenc

null 5 Sep 26, 2022
Translation (i18n) Manager as a virion

TL Translation (i18n) Manager as a virion Translation use hook-like $t = $tl->useTranslation($player->getLocale()); $player->sendMessage($t("message-k

RedMC Network 3 Oct 28, 2022
Composer package providing translation features for PHP apps

PHP translation This is a composer package providing translation support for PHP applications. It is similar to gettext, in usage, with these differen

Sérgio Carvalho 0 Aug 15, 2022
A Symfony Feature Flag Bundle which easily allows you to configure and use your favorite feature flag provider.

Metro Markets FF Metro Markets FF is a Feature Flag Symfony Bundle. It easily allows you to configure and use your favorite feature flag provider. Ins

METRO Markets 14 May 23, 2022
Symprowire is a PHP MVC Framework based and built on Symfony, using the ProcessWire CMS as DBAL and Service Provider.

Symprowire - PHP MVC Framework for ProcessWire 3.x Symprowire is a PHP MVC Framework based and built on Symfony using ProcessWire 3.x as DBAL and Serv

Luis Mendez 7 Jan 16, 2022
A simple yet powerful HTTP metadata and assets provider for NFT collections using Symfony

Safe NFT Metadata Provider A simple yet powerful HTTP metadata and assets provider for NFT collections using Symfony.

HashLips Lab 66 Oct 7, 2022
Symfony React Blank is a blank symfony and react project, use this template to start your app using Symfony as an backend api and React as a frontend library.

Symfony React Blank Symfony React Blank is a blank symfony and react project, use this template to start your app using Symfony as an backend api and

Antoine Kingue 2 Nov 5, 2021
Multi-provider authentication framework for PHP

Opauth is a multi-provider authentication framework for PHP, inspired by OmniAuth for Ruby. Opauth enables PHP applications to do user authentication

Opauth – PHP Auth Framework 1.7k Jan 1, 2023