ADVICE: multi-language database content support for Gallery2
nepto
![]()
Joined: 2004-07-06
Posts: 22 |
![]() |
Yet another feature/hack from me, probably the last one Multilanguage site is a site serving content in more than one language, typically in two languages - native one and the english one. For example my http://nepto.sk/ is serving content in the slovak language as well as in the english language. Once you have this kind of site, you may want to have multilanguage not only interface, but some of the database content as well. For example the name of root node in the Gallery2 is called "Gallery. Assume that in your native language is "Gallery" called "Galeria" (this is how we say "Gallery" in the Slovakia). When serving engligh language content, "Gallery" should be fetched from database, when serving other (slovak) language content "Galeria" should be fetched from database. But there is only one field/column, so how to achieve this kind of behaviour? It is not so difficult as it probably might looks like! We will use Smarty modifiers for this task and store database content in this form:
If you find this advice useful or you have some questions or troubles, please let me know. Nepto, http://nepto.sk/[/] |
|
mindless
![]()
Joined: 2004-01-04
Posts: 8601 |
![]() |
interesting approach.. |
|
bharat
![]()
Joined: 2002-05-21
Posts: 7994 |
![]() |
Neat hack! I hope that this isn't the last one.. your hacks are very thought provoking. The main problem I have with this approach is that we're storing non-normalized data in the database. It's definitely a workable short term solution, but I know that it will lead to all kinds of interesting long term issues. For example, we'll have to know that we have non normalized data when we export data to EXIF, IPTC, as XML, etc. We'll also have issues with searching the data because our SQL will search the entire column, and can't limit itself to the active language. I agree that we should get this functionality into the product; I'm still just not sure what will be the best way to do it... |
|
nepto
![]()
Joined: 2004-07-06
Posts: 22 |
![]() |
bharat, I'm considering your comment as a compliment, thanks ;-) Of course, this is not the *solution*. This is a hack. And it is the reason why I posted it here to the forums and not for example to the developer mailinglist. I hope this will be archived for a longer period and anyone interested and capable can use it. Several months ago I was in need to estabilish my gallery imediately, because I had a really huge amount of pending photos. I was sure that if I would not put them on the website then, I will never do so. So I went with hacks... Now I'm starting to watch Gallery2 development again. I see you did a good job during last few months. There is stable release 2, even 2.0.1. That is great! Once all my requirements will be met, I will migrate my gallery instance to the stable release. Of course I will make some code upgrades, if neccessary. I'm skilled PHP coder, however I know nothing about G2 API. But that is not a big problem anyway. If I will find a time, I'll provide you with serious patches. |
|
valiant
Joined: 2003-01-04
Posts: 32509 |
![]() |
also see: |
|
jraczkow
Joined: 2005-10-26
Posts: 7 |
![]() |
Hi.. Sorry for not being competent enough, but I'm just starting with Gallery (and in the same moment PHP/Smarty/SQL everything....). |
|
valiant
Joined: 2003-01-04
Posts: 32509 |
![]() |
jraczkow what are you refering to? |
|
jraczkow
Joined: 2005-10-26
Posts: 7 |
![]() |
Hi, Either way... Where should this modifier be put to be visible for another classes? (I put it to /lib/smarty/plugins/modifier.lang_extract.php but still it doesn't work (and cleared the cache). Thanks! (Great JoB!!!! WOW!) |
|
valiant
Joined: 2003-01-04
Posts: 32509 |
![]() |
you've got to differentiate between: 1. is text that ships with G2 / G2 themes / modules. These texts are handled by G2's translations that ship with G2 / G2's modules/themes 2. is text that you added. you added titles, descriptions, summaries etc. the combination of 1. and 2. results in a 100% translated / localized G2 experience for all your users. |
|
u4david
Joined: 2007-03-25
Posts: 11 |
![]() |
I'm more interested in actual translation of non default g2 text.Typing all in more languages can get out of date.So actual on fly translation would be the way to go. |
|
valiant
Joined: 2003-01-04
Posts: 32509 |
![]() |
If google offers an API to translate stuff via GData or so, why not. -------------- |
|
gopu
![]()
Joined: 2009-08-28
Posts: 137 |
![]() |
Hello, Since the thread is similar to what I want, I am posting my queries in this thread. I would like to develop (or enhance the existin multilang) module that will enable user to have multilingual URLs for items, with rewrite module enabled. Quote:
http://mysite.com/galería/v/rosa/hermosa_rosa.html Can somebody please give me some pointer to go about to implement it? ----------------------------- |
|