This is my relevant directory tree
├── app
│ ├── languages
│ │ └── hr_HR.utf8
│ │ └── LC_MESSAGES
│ │ ├── messages.mo
│ │ └── messages.po
So, let's imagine you want to create a translation for German language (along side the above Croatian), you would then add/have
├── app
│ ├── languages
│ │ └── hr_HR.utf8 # Croatian
│ │ └── LC_MESSAGES
│ │ ├── messages.mo
│ │ └── messages.po
│ │ └── de_DE.utf8 # German
│ │ └── LC_MESSAGES
│ │ ├── messages.mo
│ │ └── messages.po
Let's imagine that your default language is English (which will be shown if no translation is found).
So, your German messages.po file looks like this:
msgid "yes"
msgstr "ja"
msgid "no"
msgstr "nein"
msgid "Sign-in"
msgstr "Anmelden"
And your Croatian messages.po file looks like this:
msgid "yes"
msgstr "da"
msgid "no"
msgstr "ne"
msgid "Sign-in"
msgstr "Prijava"
.po files cannot be used as it is. You need to convert them to binary .mo files. I use a tool called Virtaal (https://virtaal.translatehouse.org/) for that. Basicly I load a .po file into Virtaal and export a .mo file. This could be of course automated.
And in a controller I use it like this:
$variable = $this->translation->_('Sign-in');
$this->view->setVars([
'variable' => $variable # or directly $this->translation->_('Sign-in')
]);
And then use the above $variable in your view file.
If you want to do translations directly in volt file you can first pass the translation service as a variable (from controller or better from the base controller):
$this->view->setVars([
't' => $this->translation
]);
And then use it in .volt file like this:
{{ t._('Sign-in') }}
Hopefully this will set you on a right track.