Merge pull request #13063 from nextcloud/enh/document-force-language

This commit is contained in:
Kate
2025-04-22 12:27:30 +02:00
committed by GitHub
3 changed files with 17 additions and 0 deletions

View File

@@ -125,6 +125,7 @@ Added APIs
- New events ``OCP\User\Events\BeforeUserIdUnassignedEvent``, ``OCP\User\Events\UserIdUnassignedEvent``, and ``OCP\User\Events\UserIdAssignedEvent`` have been added to replace the hooks ``\OC\User::preUnassignedUserId``, ``\OC\User::postUnassignedUserId`` and ``\OC\User::assignedUserId``.
- New interface ``OCP\Files\Storage\IConstructableStorage`` for storages that can be built by passing only an array to the constructor.
- New service ``OCP\RichObjectStrings\IRichTextFormatter`` to format rich text into parsed plain text using its ``richToParsed`` method.
- New magic query parameter ``forceLanguage`` to force a specific language for a web request (API or frontend). See :ref:`Forcing language for a given call<api-force-language>`.
Changed APIs
^^^^^^^^^^^^

View File

@@ -327,3 +327,8 @@ Adding translations
-------------------
The steps how to set up translations for an app have been moved to it's own page in the "App development" chapter: :ref:`Translation setup`
Testing translations
--------------------
You can use the query parameter ``forceLanguage`` to force a specific language for a web request (API or frontend). See :ref:`Forcing language for a given call<api-force-language>`.

View File

@@ -255,3 +255,14 @@ In case needed, you can also further filter the auto-complete results on the PHP
``OCP\Collaboration\AutoComplete\AutoCompleteEvent`` event. The event gives you access to the current
result set, the item and share types and some more information that you can use to e.g. limit the autocomplete
results to users that are actually in the current chat conversation.
.. _api-force-language:
Force language for a given call
-------------------------------
All Nextcloud API calls support forcing the language using the query parameter ``forceLanguage``. It will override any user setting for the given call.
.. code-block:: bash
curl -u username:password -X GET 'https://cloud.example.com/ocs/v1.php/...?forceLanguage=en' -H "OCS-APIRequest: true"