Re: [poedit-users] Fwd: gettext localize strings with variables
Václav Slavík <[email protected]> Thu, 28 Jul 2011 18:16:23 +0200
| Newsgroups | gmane.editors.poedit.user |
|---|---|
| Message-ID | <[email protected]> |
--===============4669821540862681662==
Content-Type: multipart/alternative; boundary=Apple-Mail-8-702617885
--Apple-Mail-8-702617885
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain;
charset=us-ascii
On 28 Jul 2011, at 15:38, Peter Irbizon wrote:
> print _('This is %(OUHH)s a translatable string.' % locals())
>=20
> how can I translate this ?
For starters, that should be=20
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 =
gettext fundamentals, I believe you'll find that any manual or tutorial =
for your (unspecified) language's binding explains all that in detail.
Vaclav=
--Apple-Mail-8-702617885
Content-Transfer-Encoding: quoted-printable
Content-Type: text/html;
charset=us-ascii
<html><head></head><body style=3D"word-wrap: break-word; =
-webkit-nbsp-mode: space; -webkit-line-break: after-white-space; =
"><br><div><div>On 28 Jul 2011, at 15:38, Peter Irbizon =
wrote:</div><blockquote type=3D"cite"><span class=3D"Apple-style-span" =
style=3D"border-collapse: separate; font-family: 'Lucida Grande'; =
font-style: normal; font-variant: normal; font-weight: normal; =
letter-spacing: normal; line-height: normal; orphans: 2; text-align: =
-webkit-auto; text-indent: 0px; text-transform: none; white-space: =
normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: =
0px; -webkit-border-vertical-spacing: 0px; =
-webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: =
auto; -webkit-text-stroke-width: 0px; font-size: medium; ">print _('This =
is %(OUHH)s a translatable string.' % locals())<br><br>how can I =
translate this ?</span></blockquote></div><br><div>For starters, that =
should be </div><div><br></div><div> print _('This is =
%(OUHH)s a translatable string.') % =
locals()</div><div><br></div><div>because _()'s argument can only be a =
_string literal_. Then you, well, translate it, preserving special stuff =
like %(...). That's a bit of gettext fundamentals, I believe you'll find =
that any manual or tutorial for your (unspecified) language's binding =
explains all that in =
detail.</div><div><br></div><div>Vaclav</div></body></html>=
--Apple-Mail-8-702617885--
--===============4669821540862681662==
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
--===============4669821540862681662==
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
--===============4669821540862681662==--