RE: translating in different languages

From: Date: Mon, 05 Mar 2001 09:57:50 +0000
Subject: RE: translating in different languages
References: 1 2  Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-302@lists.php.net to get a copy of this message
On Mon, Mar 05, 2001 at 07:10:42AM +0100, Alain Fontaine wrote: > Smarty is a template system, so I don't really see why it should be able to > handle translation as well. As with OOP, 'keep it simple' :). Anyway, I think that translations would be a natural thing to integrate into a template system, in the end, translating is a display issue: you just want your texts to show up in another language, without having to worry about more. > there's no problem at all with using stphp and smarty together, for Stphp doesn't look as convenient to me. It's ok for sites with a few pages, but putting eval (ST ("TheThreeMusketeers", "\$string", "en")); echo "<p><b>$string</b>"; in templates will not make it look better, and make the job of template editors harder. This is especially true in shops where there is a strict distinction between programmers, template designers and translators. There already is a good foundation in Smarty for this sort of thing, why not use it? However, I do agree that there is a need for a flexible way of string substitutions. Also, with stphp and gettext you are limited to storing the translations in files, while it would in some places be easier to use a database. There will be only little performance losses here, as Smarty would compile the scripts into php with translated texts. > instance. Or using several template files (file_en.tpl, file_fr.tpl, > file_de.tpl) for different languages. Or am I missing the point here ? Uhm, yes, if you suggest this, you are missing the point :-) Let's say I translate my templates in 10 languages (which is what I need it for, and this number of languages will likely increase in the future). Now I want to add a paragraph between the header and the start of the actual text on the page. If I follow your suggestion, I would have to change 10 templates. > > -----Message d'origine----- > > De : Maciek Uhlig [mailto:muhlig@us.edu.pl] > > Objet : [smarty] RE: translating in different languages > > First, thank you for mentioning Polish in your text :-) Heh, it was just an example, but you're welcome anyway :-) > > http://stphp.sourceforge.net . In brief, to correctly > > translate a > > string from English to Polish simple string substitution is not > > enough. You need to supply a function, which allows the translator > > to manipulate texts. Just look at the very simple example (life is > > more complicated than that): > > in English: > > there is 1 apple in the basket > > there are 2 apples in the basket > > there are 5 apples in the basket > > in Polish, respectively: > > w koszyku jest 1 jablko /* look at 'jest' */ > > w koszyku sa 2 jablka /* look at 'sa' */ > > w koszyku jest 5 jablek /* look at 'jest' */ This is an issue in every language you want to translate to. If you want to have numbers that can vary, you have to supply a translation for every sentence, also for things like first, second, ... This is different in almost every language I know, and as you indicated, also in Polish. I don't think it would be wise to try to implement some sort of AI functionality to try to translate these things. In my experience, it is almost always possible to rewrite your sentence so that you can use the normal number (eg 'Number of apples in the basket: 1', don't know about the polish translation, but I think you get my point). It's not so nice, but this sort of things is very complex and goes beyond the scope of a translation system. Could someone shed a light on how GNU Gettext handles this? cheers, roel > > > > Funny, eh? Do you feel it? > > > > Third, the real problem is not related to Smarty at all. > > > > Maciek > > > > > -----Original Message----- > > > From: Roel Vanhout [mailto:roel@2e-systems.com] > > > Sent: Sunday, March 04, 2001 9:25 PM > > > To: smarty@lists.ispi.net > > > Subject: [smarty] translating in different languages > > > > > > > > > Hi, > > > > > > I'm in the process of adding multi-language support to Smarty. I have > > > written a preliminary design text on this, which I have attached. I also > > > have code to implement the described functionality, but I haven't > > > attached it yet as I want to refine it a bit first before releasing. I > > > was hoping someone would have some time to read this text, and give some > > > thought/remarks about it. I think it is configurable enough for pretty > > > much every situation, but if you think it can be made more generic, let > > > me know. I hope to be ready with the rest of the code tomorrow or the > > > day after, I just wanted to get this text out to get some feedback on > > > it. > > > > > > cheers, > > > > > > roel > > > > > > > > > --- > > You are currently subscribed to smarty as: alain@nvision.lu > > To unsubscribe send a blank email to $subst('Email.Unsub') > > Visit Smarty's homepage at > > http://www.phpinsider.com/php/code/Smarty/ > > > > > > --- > You are currently subscribed to smarty as: roel@2e-systems.com > To unsubscribe send a blank email to $subst('Email.Unsub') > Visit Smarty's homepage at > http://www.phpinsider.com/php/code/Smarty/ -- ALL YOUR BASE ARE BELONG TO US

« previous php.smarty.general (#302) next »