@@ -22,24 +22,24 @@ Using the Language System in php
2222================================
2323
2424The object holding the language dictionary for the current user is the ``$user ``
25- object (``phpbb\user `` class). To get the translation of a language entry inside
26- of php code, call the ``phpbb\user ::lang() `` method:
25+ object (``phpbb\language\language `` class). To get the translation of a language
26+ entry inside of php code, call the ``phpbb\language\language ::lang() `` method:
2727
2828.. code-block :: php
2929
30- $user ->lang('LANG_KEY');
30+ $language ->lang('LANG_KEY');
3131
3232 You can also insert values into translated string. Use ``%s `` as placeholders
3333for string in the language string and ``%d `` for integers:
3434
3535.. code-block :: php
3636
3737 // Language string: "My translation has a %s"
38- echo $user ->lang('LANG_KEY', 'parameter');
38+ echo $language ->lang('LANG_KEY', 'parameter');
3939 // Output: "My translation has a parameter"
4040
4141 // Language string: "My translation has %d parameter"
42- echo $user ->lang('LANG_KEY', 1);
42+ echo $language ->lang('LANG_KEY', 1);
4343 // Output: "My translation has 1 parameter"
4444
4545 .. warning ::
@@ -55,13 +55,14 @@ for string in the language string and ``%d`` for integers:
5555The dictionary is not loaded into memory all at once, but is split up in several
5656files, which have to be manually loaded on demand. The files are stored inside
5757the language directory, named after its
58- `language tag <https://area51.phpbb.com/docs/31x /coding-guidelines.html#translation >`_,
58+ `language tag <https://area51.phpbb.com/docs/master /coding-guidelines.html#translation >`_,
5959where one subdirectory is used for each installed language. The default language
6060files are in the root of that subdirectory, while ACP language files go into the
6161``/acp `` subdirectory; email templates are placed in the ``/email ``
6262subdirectory.
6363
6464.. note ::
65+
6566 Files for extensions should be placed in the extension's ``/language ``
6667 directory.
6768
@@ -84,22 +85,22 @@ pass the name with the subdirectory but without extension as argument of setup.
8485 $user->setup(array('ucp', 'search'));
8586
8687 Since ``phpbb\user::setup() `` must only be called once,
87- ``phpbb\user ::add_lang() `` has to be used, to load additional language files,
88- after ``phpbb\user::setup() `` has already been called.
88+ ``phpbb\language\language ::add_lang() `` has to be used, to load additional
89+ language files, after ``phpbb\user::setup() `` has already been called.
8990
9091Loading from an extension
9192-------------------------
9293
9394To load a file from an extension
94- you need to use ``phpbb\user ::add_lang_ext() `` which takes
95+ you need to use ``phpbb\language\language ::add_lang_ext() `` which takes
9596the vendor + extension name as first argument and the array of language files as
9697a second argument.
9798
9899.. code-block :: php
99100
100- $user->add_lang_ext('acme/ demo', 'demo');
101+ $language->add_lang(' demo', 'acme/ demo');
101102 // or
102- $user->add_lang_ext('acme/demo', array('demo', 'demo2'));
103+ $language->add_lang( array('demo', 'demo2'), 'acme/demo' );
103104
104105 Using the Language System in template files
105106===========================================
0 commit comments