You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: translation.rst
+13Lines changed: 13 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -771,6 +771,19 @@ now use the following commands to push (upload) and pull (download) translations
771
771
The ``--as-tree`` option of the ``translation:pull`` command was introduced
772
772
in Symfony 6.4.
773
773
774
+
Creating Custom Providers
775
+
~~~~~~~~~~~~~~~~~~~~~~~~~
776
+
777
+
In addition to using Symfony's built-in translation providers, you can create
778
+
your own providers. To do so, you need to create two classes:
779
+
780
+
#. The first class must implement :class:`Symfony\\Component\\Translation\\Provider\\ProviderInterface`;
781
+
#. The second class needs to be a factory which will create instances of the first class. It must implement
782
+
:class:`Symfony\\Component\\Translation\\Provider\\ProviderFactoryInterface` (you can extend :class:`Symfony\\Component\\Translation\\Provider\\AbstractProviderFactory` to simplify its creation).
783
+
784
+
After creating these two classes, you need to register your factory as a service
785
+
and tag it with :ref:`translation.provider_factory <reference-dic-tags-translation-provider-factory>`.
0 commit comments