Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Non-translated properties of entity with TranslateBehaviour

We're building an app that is internationalised in Cakephp 3.0.8 , and with all static stuff everything is fine, but we're having some issues with the translation of database contents.

In the process of building an interface for our translators to translate content in the tables, it would be awesome to be able to have an interface with something like: +---------+---------+--------+---------+---------+ | English | Danish | German | Spanish | Swedish | +---------+---------+--------+---------+---------+ | Save | Gem | ____ | ____ | ____ | | Edit | Rediger | ____ | ____ | ____ | +---------+---------+--------+---------+---------+

so the translators can start working on the missing translations. Point is that all the strings that have missing translations should just be shown here

To achieve this, it would be nice to be able to get

  1. All fields in a table, that should be translated
  2. Translations for the already translated fields

But especially 1) seems quite hard, or are we missing something?

We're using the core TranslationBehaviour (link)

like image 423
Spriz Avatar asked Jul 15 '15 08:07

Spriz


1 Answers

Pasting the answer on behalf of the original question author:

Allright, I got the answer for 1) from #cakephp @ Freenode.org. The following will output the correct fields that should be translated:

$this->TableName->behaviors()->get('Translate')->config('fields');

Translation for already translated fields can be retrieved by using $table->find('translations')

like image 142
José Lorenzo Rodríguez Avatar answered Nov 14 '22 23:11

José Lorenzo Rodríguez