Seaside and gettext not exporting domain strings

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
12 messages Options
Reply | Threaded
Open this post in threaded view
|

Seaside and gettext not exporting domain strings

StormByte
I am following guide from https://code.google.com/p/seaside/wiki/Gettext,
and also, downloaded Seaside-Gettext-Examples-pmm.4.mcz from monticello
source http://www.squeaksource.com/Seaside30Addons.

It seems a good source of learning gettext integration into seaside.

To test the example, I just doit: WAGettextExample register, and enter to
localhost:8080/gettext.

It displays good, but when I try to export the domain strings, via
evaluating WAGettextExample export, I only get pharo strings, and not the
gettext domain strings present there.

As it is an autoconfigurable example, and little enough, can someone point
me in the right direction about what is happening?



_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Seaside and gettext not exporting domain strings

StormByte
David Carlos Manuelda wrote:

> I am following guide from https://code.google.com/p/seaside/wiki/Gettext,
> and also, downloaded Seaside-Gettext-Examples-pmm.4.mcz from monticello
> source http://www.squeaksource.com/Seaside30Addons.
>
> It seems a good source of learning gettext integration into seaside.
>
> To test the example, I just doit: WAGettextExample register, and enter to
> localhost:8080/gettext.
>
> It displays good, but when I try to export the domain strings, via
> evaluating WAGettextExample export, I only get pharo strings, and not the
> gettext domain strings present there.
>
> As it is an autoconfigurable example, and little enough, can someone point
> me in the right direction about what is happening?

By modifying a little the example, I noticed that if I send the "translated"
message to strings they get added to the .pot file and indeed it generates
the template.

But shouldn't it be the translate: function for that so I don't need to put
translated everywhere?

_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Seaside and gettext not exporting domain strings

Stephan Eggermont-3
In reply to this post by StormByte
You might want to borrow some code from QCMagritte.
There we describe our model with Magritte, and use
an extra visitor to hide the translated for label, hint
and error messages. It also provides a UI.

https://www.youtube.com/watch?v=cTut44Xs3_U

Stephan
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Seaside and gettext not exporting domain strings

StormByte
Stephan Eggermont wrote:

> You might want to borrow some code from QCMagritte.
> There we describe our model with Magritte, and use
> an extra visitor to hide the translated for label, hint
> and error messages. It also provides a UI.
>
> https://www.youtube.com/watch?v=cTut44Xs3_U
>
> Stephan
Hi Stephan, thank you for your answer.

Yes, I've been reading also about QCMagritte, and played with the demo.

Just that it seems to work only with csv import/export, can it work also
with regular po/pot/mo files from gettext?

_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Seaside and gettext not exporting domain strings

StormByte
David Carlos Manuelda wrote:

> Stephan Eggermont wrote:
>
>> You might want to borrow some code from QCMagritte.
>> There we describe our model with Magritte, and use
>> an extra visitor to hide the translated for label, hint
>> and error messages. It also provides a UI.
>>
>> https://www.youtube.com/watch?v=cTut44Xs3_U
>>
>> Stephan
> Hi Stephan, thank you for your answer.
>
> Yes, I've been reading also about QCMagritte, and played with the demo.
>
> Just that it seems to work only with csv import/export, can it work also
> with regular po/pot/mo files from gettext?
OK, I found the solution and I want to share with you all, in case someone
have also this problem.

I ended exploring ConfigurationOfSeaside3 class, because I've read it has
support in 3.1+, and indeed it has.

I evaluated:
( ConfigurationOfSeaside3 project version: #stable ) load: 'Seaside-Gettext-
Core'.
( ConfigurationOfSeaside3 project version: #stable ) load: 'Seaside-Gettext-
Examples'.

And noticed that the problem went away.

So this converted to an update request for the wiki maintainers located at
https://code.google.com/p/seaside/wiki/Gettext to update the information,
because following those steps mentioned there will lead to a non working
install of Seaside-Gettext-Core (maybe outdated packages in that repo).

_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Seaside and gettext not exporting domain strings

Stephan Eggermont-3
In reply to this post by StormByte
David wrote:
>Just that it seems to work only with csv import/export, can it work also
>with regular po/pot/mo files from gettext?

I haven't neede them yet. Looks like a simple enough format.
What are the advantages of it? Are there better tools than a spreadsheet
for this? With the translations in-system, I can add a translation mode
to a webpage/component.

Stephan
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Seaside and gettext not exporting domain strings

StormByte
Stephan Eggermont wrote:

> David wrote:
>>Just that it seems to work only with csv import/export, can it work also
>>with regular po/pot/mo files from gettext?
>
> I haven't neede them yet. Looks like a simple enough format.
> What are the advantages of it? Are there better tools than a spreadsheet
> for this? With the translations in-system, I can add a translation mode
> to a webpage/component.
>
> Stephan

Hi Stephan,

Well, in my opinion, gettext has some advantages over simple csv dictionary
translations, there are tools to translate also, like Poedit, while the
issue is not about if there are or not better tools.

What makes gettext more powerful is that it supports different plural forms
(for example), since there are languages that don't have only a singular and
a plural form, and I guess it has more.

If you find time, you could look at it http://en.wikipedia.org/wiki/Gettext.

_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Seaside and gettext not exporting domain strings

StormByte
David Carlos Manuelda wrote:

> Stephan Eggermont wrote:
>
>> David wrote:
>>>Just that it seems to work only with csv import/export, can it work also
>>>with regular po/pot/mo files from gettext?
>>
>> I haven't neede them yet. Looks like a simple enough format.
>> What are the advantages of it? Are there better tools than a spreadsheet
>> for this? With the translations in-system, I can add a translation mode
>> to a webpage/component.
>>
>> Stephan
>
> Hi Stephan,
>
> Well, in my opinion, gettext has some advantages over simple csv
> dictionary translations, there are tools to translate also, like Poedit,
> while the issue is not about if there are or not better tools.
>
> What makes gettext more powerful is that it supports different plural
> forms (for example), since there are languages that don't have only a
> singular and a plural form, and I guess it has more.
>
> If you find time, you could look at it
> http://en.wikipedia.org/wiki/Gettext.
Also, I forgot to say that it supports also the translation process, like
fuzzy translations, which can be reviewed later, more info at
https://www.gnu.org/software/gettext/manual/html_node/PO-Files.html

In my opinion, I advise its usage.

_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Seaside and gettext not exporting domain strings

Stephan Eggermont-3
In reply to this post by StormByte
David wrote:
>Well, in my opinion, gettext has some advantages over simple csv dictionary 
>translations, there are tools to translate also, like Poedit, while the 
>issue is not about if there are or not better tools. 

I was less than impressed by POEdit. For the use case we had
(not so large application, only a few languages), Excel was 
definitely superior. For large translations, I'd want application
integration, as the texts also have to fit on the screen.
With the right abstractions, I should be able to generate
translation components in the web application. Both in the
sense as showing a translated part of a page, as in showing 
where a text is used. That is something that seems 
difficult to do with gettext. To me, the only advantage 
POEdit Pro seems to have is the reuse of existing translations.

Stephan



_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Seaside and gettext not exporting domain strings

StormByte
Stephan Eggermont wrote:

> David wrote:
>>Well, in my opinion, gettext has some advantages over simple csv
>>dictionary translations, there are tools to translate also, like Poedit,
>>while the issue is not about if there are or not better tools.
>
> I was less than impressed by POEdit. For the use case we had
> (not so large application, only a few languages), Excel was
> definitely superior. For large translations, I'd want application
> integration, as the texts also have to fit on the screen.
> With the right abstractions, I should be able to generate
> translation components in the web application. Both in the
> sense as showing a translated part of a page, as in showing
> where a text is used. That is something that seems
> difficult to do with gettext. To me, the only advantage
> POEdit Pro seems to have is the reuse of existing translations.
>
> Stephan
OH, with gettext you can see where the text is placed, because it is
autogenerated in comments inside the po(t) file. Like for example:

#: Seaside-Gettext-Examples,WAGettextExample>>renderContentOn:
msgid "fontsize"
msgstr "" --> This is the translation key

_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Seaside and gettext not exporting domain strings

Johan Brichau-2
Hi,

We’re using gettext with +3000 strings to translate in 3 languages (for now).

I try to keep it up to date but there is some refactoring required at this point…. it works well though.

On 25 Jan 2015, at 18:42, David Carlos Manuelda <[hidden email]> wrote:

Stephan Eggermont wrote:

David wrote:
Well, in my opinion, gettext has some advantages over simple csv
dictionary translations, there are tools to translate also, like Poedit,
while the issue is not about if there are or not better tools.

I was less than impressed by POEdit.

Did you try a recent version? It has improved over the past few years.

For the use case we had
(not so large application, only a few languages), Excel was
definitely superior. For large translations, I'd want application
integration, as the texts also have to fit on the screen.

Not sure how that rimes with Excel :)
But yes, live editing of the text displayed in its context is nice, though it’s difficult to impossible to do for all text (e.g tooltips, error messages, etc…).

With the right abstractions, I should be able to generate
translation components in the web application. Both in the
sense as showing a translated part of a page, as in showing
where a text is used. That is something that seems
difficult to do with gettext.

I don’t see how that conflicts with gettext (as a format).

To me, the only advantage
POEdit Pro seems to have is the reuse of existing translations.

In our experience, that’s the bad part.
The advantage of POEdit is that we supply a file of changed strings to our translator and he sees the changed, added and removed strings.

OH, with gettext you can see where the text is placed, because it is 
autogenerated in comments inside the po(t) file. Like for example:

#: Seaside-Gettext-Examples,WAGettextExample>>renderContentOn:
msgid "fontsize"
msgstr "" --> This is the translation key

This is not specific for gettext, but the format supports it.



_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Seaside and gettext not exporting domain strings

StormByte
In reply to this post by StormByte
David Carlos Manuelda wrote:

> I am following guide from https://code.google.com/p/seaside/wiki/Gettext,
> and also, downloaded Seaside-Gettext-Examples-pmm.4.mcz from monticello
> source http://www.squeaksource.com/Seaside30Addons.
>
> It seems a good source of learning gettext integration into seaside.
>
> To test the example, I just doit: WAGettextExample register, and enter to
> localhost:8080/gettext.
>
> It displays good, but when I try to export the domain strings, via
> evaluating WAGettextExample export, I only get pharo strings, and not the
> gettext domain strings present there.
>
> As it is an autoconfigurable example, and little enough, can someone point
> me in the right direction about what is happening?
I am answering my own post to the list, because I spent some hours into
looking at why it is failing to work with translations despite it should.

I want to share with you all, in case someone finds this seaside gettext
example useful in order to help others running into the same problem.

WAGettextExample has a class side method called register, which registers
itself as a seaside application and tries to configure gettext.

The original method is as follows:
WAGettextExample class>>register
   | application  |
   application := WAAdmin
    register: self
    asApplicationAt: 'gettext'.
   application preferenceAt: #sessionClass put: WAGettextExampleSession.
   application configuration addParent: WAGetTextConfiguration instance.
   application configuration at: #gettextDomain put: 'gettext'.
   TextDomainManager registerCategoryPrefix: 'Seaside-Gettext-Examples'
domain: 'gettext'.


That will lead to incomplete application registration, because it do not
register gettext domain into seaside-gettext.

The corrected method I found it to work is as follows:
WAGettextExample class>>register
  | application  |
  application := WAAdmin
   register: self
   asApplicationAt: 'gettext'.
  application preferenceAt: #sessionClass put: WAGettextExampleSession.
  application configuration addParent: WAGetTextConfiguration instance.
  application configuration at: #gettextDomain put: 'gettext'.
  "TextDomainManager registerCategoryPrefix: 'Seaside-Gettext-Examples'
domain: 'gettext'."
  "The commented line above is a mistake in WAGettext example"




I hope it could be updated to prevent new users like me to get confused by
seing things not working, and to help others :)

David.

_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside