On Mon, Nov 7, 2011 at 7:55 PM, Bruce Wade <bruce.w...@gmail.com> wrote:
> Yeah we were looking for another way with out using request because our
> class is independent of the server request.

You can use pyramid.threadlocal to get a localizer from the registry
and an arbitrary locale name. See how it work:

https://github.com/Pylons/pyramid/blob/master/pyramid/i18n.py#L192

But using a real request is the best option.

>
> On Sat, Nov 5, 2011 at 4:32 AM, Gael Pasgrimaud <g...@gawel.org> wrote:
>>
>> To be clear, you need to use a translator. Else your TranslationString
>> will act as a standard unicode string.
>> get_localizer(request).translate(_('Client'))
>> Pyramid use some magic to do that for you in chameleon templates.
>> That's why it work in your html pages.
>>
>> On Sat, Nov 5, 2011 at 6:23 AM, Bruce Wade <bruce.w...@gmail.com> wrote:
>> > The source code we are using can be found
>> >
>> > here: https://gitorious.org/bossteam/youad/blobs/master/youad/youad/invoice/model.py
>> > Look around line: 189
>> >
>> > self.pdf.drawString((LEFT)*mm, (TOP)*mm, _("Client"))
>> > That text is being extracted into the pot and po files however it is
>> > never
>> > being translated when we create the PDF document in Chinese for example.
>> >
>> > None of the translations for the Invoice class are working. Maybe we are
>> > just missing a simple setting??
>> >
>> > The rest of the sites translations work so I don't think it is a global
>> > setting we are missing.
>> >
>> > On Fri, Nov 4, 2011 at 10:09 PM, cd34 <mcd...@gmail.com> wrote:
>> >>
>> >> On Nov 4, 8:03 pm, Bruce Wade <bruce.w...@gmail.com> wrote:
>> >> > We are trying to use translation when generating a PDF file from a
>> >> > request.
>> >> > However for some reason the locale for the string is extracted from
>> >> > the
>> >> > file however when generating the PDF it never translates.
>> >> >
>> >> > Any suggestions on how to translate for reportlab using pyramid?
>> >>
>> >> when using canvas.textLines(_('translated text')), you're saying
>> >> reportlab is ignoring it?
>> >>
>> >> I just tested v2.5 and a quick test worked for me.
>> >>
>> >> There are some characters that may not render based on the font you've
>> >> chosen.
>> >>
>> >> Can you supply some sample code that doesn't work?
>> >>
>> >> --
>> >> You received this message because you are subscribed to the Google
>> >> Groups
>> >> "pylons-discuss" group.
>> >> To post to this group, send email to pylons-discuss@googlegroups.com.
>> >> To unsubscribe from this group, send email to
>> >> pylons-discuss+unsubscr...@googlegroups.com.
>> >> For more options, visit this group at
>> >> http://groups.google.com/group/pylons-discuss?hl=en.
>> >>
>> >
>> >
>> >
>> > --
>> > --
>> > Regards,
>> > Bruce Wade
>> > http://ca.linkedin.com/in/brucelwade
>> > http://www.wadecybertech.com
>> > http://www.warplydesigned.com
>> > http://www.fitnessfriendsfinder.com
>> >
>> > --
>> > You received this message because you are subscribed to the Google
>> > Groups
>> > "pylons-discuss" group.
>> > To post to this group, send email to pylons-discuss@googlegroups.com.
>> > To unsubscribe from this group, send email to
>> > pylons-discuss+unsubscr...@googlegroups.com.
>> > For more options, visit this group at
>> > http://groups.google.com/group/pylons-discuss?hl=en.
>> >
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "pylons-discuss" group.
>> To post to this group, send email to pylons-discuss@googlegroups.com.
>> To unsubscribe from this group, send email to
>> pylons-discuss+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/pylons-discuss?hl=en.
>>
>
>
>
> --
> --
> Regards,
> Bruce Wade
> http://ca.linkedin.com/in/brucelwade
> http://www.wadecybertech.com
> http://www.warplydesigned.com
> http://www.fitnessfriendsfinder.com
>
> --
> You received this message because you are subscribed to the Google Groups
> "pylons-discuss" group.
> To post to this group, send email to pylons-discuss@googlegroups.com.
> To unsubscribe from this group, send email to
> pylons-discuss+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/pylons-discuss?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" group.
To post to this group, send email to pylons-discuss@googlegroups.com.
To unsubscribe from this group, send email to 
pylons-discuss+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en.

Reply via email to