How to properly organize the localization of the site by keys. Where to store the translation?

Now on all pages instead of the text is written

echo $tr->get('localization_key');

The question is how and where to store the key translation itself. If you store them in the database, it means that this is 300-400 requests to the database from each user who visited the site.

If you store it in an array, you will have to connect absolutely all translations to the code on each page, and there may be several thousand of them.

Tell me how to store the translation correctly. Thank you

 0
php
Author: DmitryDevelop, 2020-03-15

1 answers

Store in an array and connect to each request.

Taking into account the opcode cache, this does not pose the slightest problem for the pcp.

 3
Author: Ипатьев, 2020-03-15 12:47:25