E
E
excalibur2012-12-15 20:41:42
MySQL
excalibur, 2012-12-15 20:41:42

Implementing a settings system for a multilingual site?

The names of the options are in xml files, but the values ​​of these options must be in the database. Now the settings system works fine on the site, but multilingualism has been introduced for it, so you need to take into account multilingualism and set up for the system. There are many nuances. For example, there is an option "option_api", which stores the key to the api of an external service, i.e. this key will be the same for each site language. There are options that can be set to "yes", "no", "not specified", i.e. it is either a radio button or a select - i.e. value can be used for all languages ​​of the site. But there are options that store the name, for example, the name of the site section, i.e. they are a text field and will have different values ​​for each language.
Now I store the options and their values ​​​​in 2 tables: in the first option, in the second, all the options for the values ​​\u200b\u200bof these options. Those. now you can return the old value of the option, or you can add a new one, etc. for example, an option can be an image, for example, a logo - a winter version of the logo, summer, so that you can switch depending on the season.
I do not give the structure of the tables so as not to impose my opinion. I'm using Zend Framework if that helps.
In general, please share your experience of implementing this on the site.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
doranych, 2012-12-15
@excalibur

The names of the options are in xml files, but the values ​​of these options must be in the database.

In itself, this is no longer very clear. Why keep them so store, although it's up to you.
So.
Now on to the question.
You can add language to the properties in the name. For example, ru_confname, en_confname, jp_confname and so on.
Well, in the process of requesting the desired parameter, add a language abbreviation.
There is another option, you can add a language code in the second table and query with it in mind. But this is a variation of the first option.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question