Re: [poedit-users] Fwd: gettext localize strings with variables

Peter Irbizon <[email protected]> Thu, 28 Jul 2011 20:54:39 +0200
Newsgroups gmane.editors.poedit.user
Message-ID <CABFuWSzLaT3sX+VL56zbho5xnccfdSA5SWavU4VW7-3WVUpOKQ@mail.gmail.com>
--===============6243985259603043881==
Content-Type: multipart/alternative; boundary=90e6ba6e89e878ddc704a925b214

--90e6ba6e89e878ddc704a925b214
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

thank you guys. especially many thanks to Vaclav - this solution works for
python. sorry for newbie question.
peter

2011/7/28 V=E1clav Slav=EDk <[email protected]>

>
>  On 28 Jul 2011, at 15:38, Peter Irbizon wrote:
>
> print _('This is %(OUHH)s a translatable string.' % locals())
>
> how can I translate this ?
>
>
> For starters, that should be
>
>     print _('This is %(OUHH)s a translatable string.') % locals()
>
> because _()'s argument can only be a _string literal_. Then you, well,
> translate it, preserving special stuff like %(...). That's a bit of gette=
xt
> fundamentals, I believe you'll find that any manual or tutorial for your
> (unspecified) language's binding explains all that in detail.
>
> Vaclav
>
>
> -------------------------------------------------------------------------=
-----
> Got Input?   Slashdot Needs You.
> Take our quick survey online.  Come on, we don't ask for help often.
> Plus, you'll get a chance to win $100 to spend on ThinkGeek.
> http://p.sf.net/sfu/slashdot-survey
> _______________________________________________
> Poedit-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/poedit-users
>
>

--90e6ba6e89e878ddc704a925b214
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

<div>thank you guys. especially many thanks to Vaclav - this solution works=
 for python. sorry for newbie question.</div>
<div>peter<br><br></div>
<div class=3D"gmail_quote">2011/7/28 V=E1clav Slav=EDk <span dir=3D"ltr">&l=
t;<a href=3D"mailto:[email protected]">[email protected]</a>&gt;</span><br>
<blockquote style=3D"BORDER-LEFT: #ccc 1px solid; MARGIN: 0px 0px 0px 0.8ex=
; PADDING-LEFT: 1ex" class=3D"gmail_quote">
<div style=3D"WORD-WRAP: break-word">
<div class=3D"im"><br>
<div>
<div>On 28 Jul 2011, at 15:38, Peter Irbizon wrote:</div>
<blockquote type=3D"cite"><span style=3D"TEXT-TRANSFORM: none; TEXT-INDENT:=
 0px; BORDER-COLLAPSE: separate; FONT: medium &#39;Lucida Grande&#39;; WHIT=
E-SPACE: normal; LETTER-SPACING: normal; WORD-SPACING: 0px">print _(&#39;Th=
is is %(OUHH)s a translatable string.&#39; % locals())<br>
<br>how can I translate this ?</span></blockquote></div><br></div>
<div>For starters, that should be=A0</div>
<div class=3D"im">
<div><br></div>
<div>=A0 =A0 print _(&#39;This is %(OUHH)s a translatable string.&#39;) % l=
ocals()</div>
<div><br></div></div>
<div>because _()&#39;s argument can only be a _string literal_. Then you, w=
ell, translate it, preserving special stuff like %(...). That&#39;s a bit o=
f gettext fundamentals, I believe you&#39;ll find that any manual or tutori=
al for your (unspecified) language&#39;s binding explains all that in detai=
l.</div>

<div><br></div>
<div>Vaclav</div></div><br>------------------------------------------------=
------------------------------<br>Got Input? =A0 Slashdot Needs You.<br>Tak=
e our quick survey online. =A0Come on, we don&#39;t ask for help often.<br>
Plus, you&#39;ll get a chance to win $100 to spend on ThinkGeek.<br><a href=
=3D"http://p.sf.net/sfu/slashdot-survey" target=3D"_blank">http://p.sf.net/=
sfu/slashdot-survey</a><br>_______________________________________________<=
br>
Poedit-users mailing list<br><a href=3D"mailto:[email protected]=
ge.net">[email protected]</a><br><a href=3D"https://lists.=
sourceforge.net/lists/listinfo/poedit-users" target=3D"_blank">https://list=
s.sourceforge.net/lists/listinfo/poedit-users</a><br>
<br></blockquote></div><br>

--90e6ba6e89e878ddc704a925b214--


--===============6243985259603043881==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

------------------------------------------------------------------------------
Got Input?   Slashdot Needs You.
Take our quick survey online.  Come on, we don't ask for help often.
Plus, you'll get a chance to win $100 to spend on ThinkGeek.
http://p.sf.net/sfu/slashdot-survey
--===============6243985259603043881==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
Poedit-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/poedit-users

--===============6243985259603043881==--