[checkout] Translating product names?

a9060

Joined: 2010-04-29
Posts: 2
Posted: Thu, 2010-04-29 05:56

Hi! I have not found any information about this. Is there any way to translate product names and/or descriptions in checkout-module? Any help would be appreciated.

Gallery version = 2.3 core 1.3.0
API = Core 7.54, Module 3.9, Theme 2.6, Embed 1.5
PHP version = 5.2.9-0.dotdeb.1 cgi-fcgi
Webserver = Apache
Database = mysqli 5.0.67-d7-ourdelta44-log, lock.system=flock
Toolkits = ArchiveUpload, Dcraw, Exif, Ffmpeg, Getid3, jpegtran,
23:34:55 UTC 2010 x86_64
Default theme = matrix
gettext = enabled
Locale = en_US
Browser = Mozilla/5.0 (Windows; U; Windows NT 6.1; fi; rv:1.9.2.3) Gecko/20100401 Firefox/3.6.3
Rows in GalleryAccessMap table = 37
Rows in GalleryAccessSubscriberMap table = 38
Rows in GalleryUser table = 6
Rows in GalleryItem table = 34
Rows in GalleryAlbumItem table = 4
Rows in GalleryCacheMap table = 0

 
alecmyers

Joined: 2006-08-01
Posts: 4342
Posted: Thu, 2010-04-29 08:45

Unfortunately putting new text into G2's translation system requires recompiling various files through something like poedit (or the developer tools provided with g2) and isn't something that can be done in "admin-space". You would also have to rewrite a lot of code to use the translations because the product names are not coded directly into the templates.

 
a9060

Joined: 2010-04-29
Posts: 2
Posted: Thu, 2010-04-29 11:11

OK. I just wondered if any of 'translators' would have found a way around this already. I'll have a closer look at the module code. Thanks for the quick reply.

 
alecmyers

Joined: 2006-08-01
Posts: 4342
Posted: Thu, 2010-04-29 11:21

This is an example of how you might translate a piece of text within (eg) the checkout module (i.e. not in a template):

        list ($ret, $module) = GalleryCoreApi::loadPlugin('module', 'checkout');
	if ($ret) {
	    return array($ret, null);
	}
        .
        .
	$translatedProductName = $module->translate($myProductName));

Putting that in everywhere neeeded is tedious but do-able. Harder is the fact that all the checkout.mo files would need to be re-translated and rebuilt every time a product name is changed. Also you might have to replicate the changes throughout in the payment modules too.

The gettext system that g2 uses was designed for compiled software where the translations are done once. It doesn't fit a scripted system like g2 (in php) where user-level modification is encouraged and commonplace. G3 has its own language system designed to be more flexible.