[Pharo-project] gettext implementation
Hi, I'm trying to use the gettexts packages under seaside, I firstly posted to the seaside mailingList but Philippe Marschallrecommended me to try to reach mister Hilaire on this ml. I have success to use the gettexts packages creating a .pot file, translate the website in poedit, creating the .mo and having the website in different langages. The problem occurs when I try to create a .po file to continue an incomplete translation, The previous messages follows : Hi, I'm trying to use the gettexts packages for seaSide. I finally achieve to create a .pot file, translate it with poedit and make the website translated. But now, I'm trying to create a .po file, that is a .pot file with the strings already translated and the strings remaining to translate. (a .pot file beeing an empty template to begin without any translations) We followed this tutorial : http://code.google.com/p/seaside/wiki/Gettext The versions used are : Seaside-Gettext-Core-NorbertHartl.10 Seaside-Pharo-Gettext-Core-pmm.1 Name: Gettext-HilaireFernandes.22 When I simply try : GetTextExporter new exportTranslator: NaturalLanguageTranslator current. I got : http://pix.toile-libre.org/?img=1322152172.jpg I've got the same result with any GetTextTranslator I have tryed to look for an implementors of the method "translations" but no one is implementing it, is a pkged missing? I've also tryed to replace it with 'class translators' but this sound wrong and give me another unrelated error. Thanks in advance for your help, ----- Philippe answer : It looks like you're using GetTextExporter instead of WAGetTextExporter. Can you load Seaside-Gettext-Examples and evaluate WAGettextExample export and see if that works? Cheers Philippe ----- Hello, Thanks to help. It works fine but it creates a .pot file. My goal is to create a .po file : when a site is already half translated, I'd like to create a .po file a translator can use in poedit. So the translator only has to translate the half not yet translated (and maybe bring some little corrections to the half already translated.) WAGettextExample export calls WAGetTextExporter new exportTemplate wich calls self exportTranslator: nil and we go there exportTranslator: translator "Export translation files. the file extention is 'po', or 'pot' if translator is nil " when the translator is nil, everything works well. when I try with a translator it breaks here : translationFor: aKey in: translator translator ifNil: [^'']. translator translations at: aKey ifPresent: [:s | ^s]. "If we have old camelCase translations, make space-separated words" translator translations at: aKey toCamelCase ifPresent: [:s | (s includes: Character space) ifTrue: [^s]. ^s fromCamelCase]. ^'' --------------------------- Now, I have tried to change the code of translationFor: aKey in: translator in this way : translationFor: aKey in: translator |result| translator ifNil: [^'']. result := (WALocalizationContext new translate: 'aKey'). (aKey equal result) ifTrue: [^'']. ^result. That is maybe horrible to use the WA things at this level but I tried to make it works and the only way I achieve to translate things is at the WA level.
Le 26/11/2011 17:47, Cédric Ternon a écrit :
Hi,
I'm trying to use the gettexts packages under seaside,
I firstly posted to the seaside mailingList but Philippe Marschall recommended me to try to reach mister Hilaire on this ml.
I have success to use the gettexts packages creating a .pot file, translate the website in poedit, creating the .mo and having the website in different langages.
So you get the gettext package working within your seaside application? Hilaire
Hi, I have to recognize I had some difficulties but it works, I use the packets : Seaside-Gettext-Core-NorbertHartl.10 Seaside-Pharo-Gettext-Core-pmm.1 Gettext-HilaireFernandes.22 Seaside-Gettext-Examples-pmm.5 I had to change a variable name in WATranslatedArgumentsFinder (instance) from RBBrowserEnvironment to BrowserEnvironment. Now I can create a .po file with the parts already translated, I'm sorry, I really begins in smallTalk developpement and the piece of code I sended to you had some errors : translationFor: aKey in: translator |result| translator ifNil: [^'']. result := (WALocalizationContext new translate: 'aKey'). (aKey equal result) ifTrue: [^'']. ^result. obviously, 'aKey' must be aKey and equal must be = (aKey = result) ifTrue: [^'']. Now it works and creates me a .po file with the things already translated (and their translations) and the things I still have to translate. But I clearly understand that this is no good to use WA(seaside) things in the gettext(pharo). I send you a screenshot a the seaside application and the gettext working (you have a view in english and a view in french) Thanks for the work you made. Best regards, Cédric Ternon, Brussels. PS : one of my colleague who develops this application with me thinks it's important to say you we use the pharo 1.3 image of pharo with seaside. On 26 November 2011 20:28, Hilaire Fernandes <hilaire.fernandes@edu.ge.ch>wrote:
Le 26/11/2011 17:47, Cédric Ternon a écrit :
Hi,
I'm trying to use the gettexts packages under seaside,
I firstly posted to the seaside mailingList but Philippe Marschall recommended me to try to reach mister Hilaire on this ml.
I have success to use the gettexts packages creating a .pot file, translate the website in poedit, creating the .mo and having the website in different langages.
So you get the gettext package working within your seaside application?
Hilaire
The problem seems to come from the Seaside-gettext package and not Gettext itself. Is Philip maintaining this package? If so he could integrate the necessary changes. Gettext itself should be working just fine. Hilaire Le 26/11/2011 21:27, Cédric Ternon a écrit :
Hi,
I have to recognize I had some difficulties but it works,
I use the packets :
Seaside-Gettext-Core-NorbertHartl.10 Seaside-Pharo-Gettext-Core-pmm.1 Gettext-HilaireFernandes.22 Seaside-Gettext-Examples-pmm.5
I had to change a variable name in WATranslatedArgumentsFinder (instance) from RBBrowserEnvironment to BrowserEnvironment.
Now I can create a .po file with the parts already translated, I'm sorry, I really begins in smallTalk developpement and the piece of code I sended to you had some errors :
translationFor: aKey in: translator |result|
translator ifNil: [^''].
result := (WALocalizationContext new translate: 'aKey'). (aKey equal result) ifTrue: [^'']. ^result.
obviously, 'aKey' must be aKey and equal must be = (aKey = result) ifTrue: [^''].
Now it works and creates me a .po file with the things already translated (and their translations) and the things I still have to translate.
But I clearly understand that this is no good to use WA(seaside) things in the gettext(pharo).
I send you a screenshot a the seaside application and the gettext working (you have a view in english and a view in french)
Thanks for the work you made.
Best regards,
Cédric Ternon, Brussels.
PS : one of my colleague who develops this application with me thinks it's important to say you we use the pharo 1.3 image of pharo with seaside.
On 26 November 2011 20:28, Hilaire Fernandes <hilaire.fernandes@edu.ge.ch <mailto:hilaire.fernandes@edu.ge.ch>> wrote:
Le 26/11/2011 17:47, Cédric Ternon a écrit : > Hi, > > > I'm trying to use the gettexts packages under seaside, > > I firstly posted to the seaside mailingList but Philippe Marschall > recommended me to try to reach mister Hilaire on this ml. > > > I have success to use the gettexts packages creating a .pot file, > translate the website in poedit, creating the .mo and having the website > in different langages. >
So you get the gettext package working within your seaside application?
Hilaire
-- Education 0.2 -- http://blog.ofset.org/hilaire
participants (2)
-
Cédric Ternon -
Hilaire Fernandes