Yii2 translation file editing via interface

Hi, I’ve stumbled upon the issue that I can’t seem to solve on my own and I would appreciate any help in overcoming this obstacle. Getting right to the point, I have a Yii2 application (based on advanced template) which has a translation file. Basically, what I am trying to achieve is implementing a some sort of user interface for the end user to edit the values for the corresponding translation file labels. Any ideas how to tackle this sort of a problem? Personally, I have been looking into several extensions and widgets trying to find something that would work specifically for my problem, however, all the searching was in vain. TranslateManager does not tackle exactly what I want. Which is, to put it in terms of logical steps, would be:

1.Have the developer create a translation file with values for certain elements in the application views. (done)

  1. Let the user update the string values corresponding to the labels of the specified translation file(s). (for example ‘name’ => 'Someone\‘s name’, the user interface would allow the user to edit value of the ‘name’ which would reflect at some specific place in the application.

To achieve that I would most likely need to create a sort of CRUD like application which processes the translation file and edit it accordingly. However, I am unsure whether this kind of way of tackling this problem is best way to deal with it. For that reason I am here hoping someone would give me their insight regarding this particular case.

I apologize in advance if this is not the right place for this kind of topic.

Why not to use http://www.yiiframework.com/doc-2.0/yii-i18n-dbmessagesource.html to store translated messages in database? And CRUD may be made by Gii.

There are at least two database oriented translation modules on Composer Packagist. On Packagist, do a search for ‘yii2 translate’. From Packagist, you can access the Github sites for the projects. These should give you some ideas.

Hi,

there is module for translation. I use https://github.com/zelenin/yii2-i18n-module for translation.

user can edit values.

see attached image.

Thanks for your suggestions. I really appreciate all the possible help. In my particular case I am trying to avoid of migrating my translation data to database for that reason I would prefer some sort of interface for editing the data directly from within the translation file(s). Abed Alzai, does that widget support only database translation editing or I could as well use it for editing translation files directly? I have looked into that widget, however, I am not entirely sure that it has the functionality I am seeking.

Hi, It just support database.

Will the "translation" be the same for every user? Or will it be varied for each user?

If the latter, I think you should not think about your application design with the word "translation". It should rather be called "user customization" instead.

The translation will be available as a back-end module, so it will be available (as well as whole back end) only to the people that are administrating the appllication, there will be no varied options for value editing. For now I have decided to leave everything in translation files and edit the values within the files without any sort of friendly interface, but if anyone has any suggestions I am open for any ideas :).

I see.

As you may have noticed, a translation file is just a simple PHP file that returns an array of KEY-VALUE pairs in which the keys are the source strings and the values are the translated strings.

So it’s very easy for you to convert the media from a file to a db table, and vice versa.

I think you can have both of them for your storage media for the translation, the file being the master and the db being the worker. The editing will be done with the db using a CRUD interface, and the master file will be updated with the db contents from time to time.