A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2005-September/056191.html below:

[Python-Dev] string formatting and i18n

[Python-Dev] string formatting and i18n [Python-Dev] string formatting and i18nAntoine Pitrou solipsis at pitrou.net
Mon Sep 5 18:07:21 CEST 2005
Le lundi 05 septembre 2005 à 16:52 +0100, Gareth McCaughan a écrit :
> ... and should add: Of course it's usually seen as being about
> output more than about formatting, but in fact if you want
> to do what Python does with "%", C with "sprintf" and
> Common Lisp with (format nil ...) then the Right Thing in C++
> (in so far as that exists) is usually to use << with a string
> stream.

Uh, what about internationalization (i18n) ?
In i18n you can't avoid the need for parameterized strings.
For example I want to write :
	_("The file '%s' is read only") % filename
not :
	_("The file") + " '" + filename + "' " + _("is read only")

because the splitting in the second form will not translate correctly
into other languages. You *have* to supply the whole non-splitted
sentence to the translators.

The bottom line, IMHO, is that there are frequent uses that mandate a
nice and easy to use formatting operator. Python has it, let's not
remove it.

Regards

Antoine.


More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4