Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #48960
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.glorb.com!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <davea@davea.name> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.002 |
| X-Spam-Evidence | '*H*': 1.00; '*S*': 0.00; 'languages,': 0.04; 'string.': 0.05; 'see.': 0.07; 'string': 0.09; 'arguments': 0.09; 'counting': 0.09; 'english,': 0.09; 'executable': 0.09; 'preferable': 0.09; 'runtime': 0.09; 'wrapper': 0.09; 'subject:question': 0.10; 'language.': 0.14; '23,': 0.16; 'addr': 0.16; 'crude': 0.16; 'imo.': 0.16; 'literal,': 0.16; 'received:74.208.4.195': 0.16; 'files.': 0.16; 'appropriate': 0.16; 'language': 0.16; 'wrote:': 0.18; '(not': 0.18; 'code.': 0.18; 'trying': 0.19; 'replacing': 0.19; 'saying': 0.22; 'separate': 0.22; 'creating': 0.23; 'header:User-Agent:1': 0.23; 'config': 0.24; 'specifies': 0.24; 'file.': 0.24; 'source': 0.25; 'equivalent': 0.26; 'header:In-Reply-To:1': 0.27; 'point': 0.28; 'chris': 0.29; 'am,': 0.29; 'specified': 0.30; 'code': 0.31; '>>>>': 0.31; 'file': 0.32; 'actual': 0.34; "i'd": 0.34; 'problem': 0.35; 'agree': 0.35; 'something': 0.35; 'usual': 0.35; 'but': 0.35; 'there': 0.35; 'located': 0.36; 'c++': 0.36; 'format.': 0.36; 'done': 0.36; 'next': 0.36; 'possible': 0.36; 'should': 0.36; 'somebody': 0.38; 'handle': 0.38; 'to:addr:python- list': 0.38; 'files': 0.38; 'pm,': 0.38; 'to:addr:python.org': 0.39; 'even': 0.60; 'dave': 0.60; 'most': 0.60; 'french': 0.61; 'name:': 0.61; "you're": 0.61; 'making': 0.63; 'address': 0.63; 'real': 0.63; 'kept': 0.65; 'american': 0.66; 'close': 0.67; 'received:74.208': 0.68; 'physical': 0.72; 'dict,': 0.84; 'absolutely': 0.87; 'angel': 0.91; '2013': 0.98 |
| Date | Sat, 22 Jun 2013 20:46:02 -0400 |
| From | Dave Angel <davea@davea.name> |
| User-Agent | Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130510 Thunderbird/17.0.6 |
| MIME-Version | 1.0 |
| To | python-list@python.org |
| Subject | Re: n00b question on spacing |
| References | <CAJ=2b07ETuSuo2+3Xu6vMOJA+q1JwUFTezO3LaYLG8wXd+FLBQ@mail.gmail.com> <51C4D2FF.8000709@digipen.edu> <mailman.3692.1371908252.3114.python-list@python.org> <51870913-c348-4807-bc25-aa7c8fbf0001@googlegroups.com> <CAPTjJmotX6GWyA_VV3FKvxTMBp2OZT6nOk=1PSvyR6veg1Ek_w@mail.gmail.com> <51C63334.2080805@davea.name> <CAPTjJmoVsJ6ZkDfbG=Yzvh28_0oUSojFG6gXmm7q=5stDLt_Ew@mail.gmail.com> <51C639A5.5070600@davea.name> <CAPTjJmrB9VYBXqyO5eXXHKVM2g=o+GgYi7rh4sw0E9ETh7XtEA@mail.gmail.com> |
| In-Reply-To | <CAPTjJmrB9VYBXqyO5eXXHKVM2g=o+GgYi7rh4sw0E9ETh7XtEA@mail.gmail.com> |
| Content-Type | text/plain; charset=ISO-8859-1; format=flowed |
| Content-Transfer-Encoding | 7bit |
| X-Provags-ID | V02:K0:Sqxn8eiLQHcPLea11rymQ1mCdJUYTgPky/EUs6EZ5wX 2hbPkOUigSnTIlckDMVr5b+qdgwE1A+lG9GKy+tYZdLJTZnNvt MTXQU0/gWbx0piXnLnoAPPKQMIiH/A4YyGobR0EwGN3hDmb2nS voLivbL+ncku9yVvUNw7m78514EA0fcNhrw5Bi0op+3TH6avB3 h++KTU1T626rOdPC91K6uZv/rr3tas73vqqNfJlHhxtKa5FyYN 3Xy7QNzt61udpzX8gtL0UBKf1JpIAswP6eCRNq7LK7n3s0oH3Z HrLs2KzkWPX4Ov6xy56ShuisLGeAvMDl1nzX+8DVQaDZu9z5TB 2LEIDCXcyboqZ5Vmspds= |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.15 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list/> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.3717.1371948377.3114.python-list@python.org> (permalink) |
| Lines | 60 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1371948377 news.xs4all.nl 15866 [2001:888:2000:d::a6]:47446 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:48960 |
Show key headers only | View raw
On 06/22/2013 08:27 PM, Chris Angelico wrote:
> On Sun, Jun 23, 2013 at 9:56 AM, Dave Angel <davea@davea.name> wrote:
>> On 06/22/2013 07:37 PM, Chris Angelico wrote:
>>>> On the contrary, i18n should be done with config files. The format
>>>> string
>>
>>
>> **as specified in the physical program**
>>
>>
>>>> is the key to the actual string which is located in the file/dict.
>>>> Otherwise you're shipping separate source files for each language --
>>>> blecch.
>>
>>
>> What I was trying to say is that the programmereze format string in the code
>> is replaced at runtime by the French format string in the config file.
>>
>> But the language is missing the indirection I described. So you have to use
>> a (function or whatever) wrapper to look up the actual format string in the
>> config file. My point is by making that file equivalent to a dict, you get
>> to have an executable program in "programmereze" before creating any config
>> files, but still able to handle any real language with one config file per
>> language.
>>
>> This is much preferable to the usual numeric lookup, where somebody
>> specifies the 17th format string to be used at this place in the code. Even
>> when you use C++ names, they're still only a crude approximation to the real
>> purpose of the string.
>
> What you're saying is that there are ways to ameliorate the problem
> with i18n. What that means is that you broadly agree with my main
> point, which is that the format string should be kept as close as
> possible to the arguments. When you're NOT translating to multiple
> languages, the string-literal is the most appropriate way to lay this
> out, imo.
>
Absolutely (very broadly). And when I am, it's still a string literal,
just not the one the customer will see. It still should be next to the
arguments of the format. I'd be replacing something like:
line = "Customer's name: {%0}, address {%1}".format(args)
with
line = i18n(current_language, "Cussom's name: {%0}, addr {%1}", thename,
theaddr)
And the English config file would look like (not counting any escaping
or whatevers):
#SIG - American English, headerline
Cussom's name: {%0}, addr {%1}
Customer's name: {%0}, addr {%1}
The key has the misspelling's and approximations, while the value has
the actual string to be used as the object of format.
--
DaveA
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Re: n00b question on spacing Joshua Landau <joshua.landau.ws@gmail.com> - 2013-06-22 14:36 +0100
Re: n00b question on spacing Rick Johnson <rantingrickjohnson@gmail.com> - 2013-06-22 08:24 -0700
Re: n00b question on spacing Joshua Landau <joshua.landau.ws@gmail.com> - 2013-06-22 16:40 +0100
Re: n00b question on spacing Rick Johnson <rantingrickjohnson@gmail.com> - 2013-06-22 08:55 -0700
Re: n00b question on spacing Joshua Landau <joshua.landau.ws@gmail.com> - 2013-06-22 17:11 +0100
Re: n00b question on spacing Chris Angelico <rosuav@gmail.com> - 2013-06-23 09:12 +1000
Re: n00b question on spacing Rick Johnson <rantingrickjohnson@gmail.com> - 2013-06-22 17:48 -0700
Re: n00b question on spacing Chris Angelico <rosuav@gmail.com> - 2013-06-23 12:26 +1000
Re: n00b question on spacing Dave Angel <davea@davea.name> - 2013-06-22 19:28 -0400
Re: n00b question on spacing Chris Angelico <rosuav@gmail.com> - 2013-06-23 09:37 +1000
Re: n00b question on spacing Dave Angel <davea@davea.name> - 2013-06-22 19:56 -0400
Re: n00b question on spacing Chris Angelico <rosuav@gmail.com> - 2013-06-23 10:27 +1000
Re: n00b question on spacing Dave Angel <davea@davea.name> - 2013-06-22 20:46 -0400
Re: n00b question on spacing MRAB <python@mrabarnett.plus.com> - 2013-06-23 02:20 +0100
Re: n00b question on spacing Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-06-23 02:58 +0000
Re: n00b question on spacing Roy Smith <roy@panix.com> - 2013-06-22 23:12 -0400
Re: n00b question on spacing Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-06-23 03:22 +0000
Re: n00b question on spacing Chris Angelico <rosuav@gmail.com> - 2013-06-23 13:36 +1000
Re: n00b question on spacing Roy Smith <roy@panix.com> - 2013-06-23 09:43 -0400
Re: n00b question on spacing Chris Angelico <rosuav@gmail.com> - 2013-06-23 14:09 +1000
Re: n00b question on spacing Dave Angel <davea@davea.name> - 2013-06-22 21:35 -0400
Re: n00b question on spacing Terry Reedy <tjreedy@udel.edu> - 2013-06-23 11:40 -0400
csiph-web