config2/childwp.inc.php

Ideas and plans to talk about
Antworten
oliver

Hi,

is there any problem to move the content of childwp.inc.php to the database like the table cache_attrib?
(parking and reference point is not detected for translation by translate.php)


Kind regards,
Oliver
sva_cacher

Hi,

I'm not too keen on the idea of putting things in the database just for the sake of translation. I would opt for a different solution. How about adding a translate comment before the string and have translate.php look for the comment? For example:

ChildWp_Type(1, /*tr*/'Parking');

Regards,
Kristian
oliver

Hm, okay ... i think there are several advantages of having the values in the database.
- we can include the description in sql queries like we do it with the attributes
- we can check the consistency with simple sql queries

Where is the disadvantage of the lookup table?
We do it with many tables and there are no problems with it.
(cache_status, cache_attrib, cache_type etc.pp.)

We also have a php-cache-file the fills this tables in an php-array (pre-translated).
So performance is also no issue.

Translation could be done by ChildWp_Type(1, $translate->t('Parking'));

But this is "the realy last option".
sva_cacher

I strive to keep things simple. Creating a small configuration file was the simplest thing I could imagine.

One disadvantage of having the information in the database is that you cannot know the current state unless you explicitly look at the data in the database. If the information is stored in a file in the repository there are never any questions. Get the latest files and you have the latest information, whether it is on the server or your local development computer.

I prefer to place data in a database only when it is needed in the database, not just because it possible to place it there. Yes, there are advantages of having the values in the database. But it's only an advantage if you actually use it. Otherwise it might become a liability instead.

I've stopped trying to anticipate future needs. I've realized that I'm not good at it. Instead I try to write code that's easy to modify. And then modify the code when a new need emerges. With that said, I don't think there is any problem with moving the values to the database. The code should be able to handle it. And I've already said what I think about the suggested change, so I won't repeat it.
oliver

Okay, i realy tried to get translation running with config2/childwp.inc.php
But due to the (unsupported) mix of "old" and "new" template system inside one PHP-file, i got various errors ...

So i changed it to the database which works well.

I think its important not to mix too many design patterns.
After we dropped the old template system we can do "cleanup of bad patterns".
Antworten