Getting array of all translations?

Hii there,

a bit of a weirder question but is there a way to obtain a list of all translation strings (not the languages themselves) in CakePHP?
I want to make a shell plugin that should get translations using an API we use at work (to save a lot of manual labour) and was wondering if a function for getting all the translations needed.

in the app itself:

echo __('Hello World!');

in the shell:

$translations = Translations::get();
pr($translations);

With an output of something like this:

array (
  [0] => "Hello World!"
)

Hi,

the extract-command might be interesting for you:

https://book.cakephp.org/3.0/en/console-and-shells/i18n-shell.html

You could e.g. write a little bash-script that generates the PO-file, submits it to your translation-API and then saves it in your application or something like that.

1 Like

This might be just what I needed, thanks!

I’ll report back if I have more questions