[Doc-SIG] Translating sample programs in documentation

Xuan Wu fromwheretowhere.service at gmail.com
Sun Apr 15 14:45:08 EDT 2018

I posted this to python-dev list but I suppose here is better place.

Excuse me if this was discussed before, but in French and Japanese 
translations, all the sample programs seem to have identifiers in 
English still. According to "PEP 545 -- Python Documentation 
Translations", as I understand .po files are used for translations. May 
I ask if there are technical restrictions causing translations being 
only applied to the text parts?

For example, here's the first sample program in 4.2:

>>># Measure some strings:
... words  =  ['cat',  'window',  'defenestrate']
>>>for  w  in  words:
...      print(w,  len(w))
cat 3
window 6
defenestrate 12

Here's a possible translation in Chinese:

>>> # 丈量一些字符串
... 词表 = ['猫', '窗户', '丢出窗户']
>>> for 词 in 词表:
...     print(词, len(词))
猫 1
窗户 2
丢出窗户 4

As you may notice the strings differ in size if they are translated 
directly. Obviously that does add extra burden to review the new sample 
programs to assure effectiveness and readability.
Any suggestion or comments are welcome.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/doc-sig/attachments/20180415/53bc1321/attachment.html>

More information about the Doc-SIG mailing list