I've been thinking about the design issues for coding i18n in develop. The problem is that if you want to translate identifiers at all, you immediately have to work with multiple dictionaries for all the modules you're importing. Initially I just slogged in and tried to start coding something that would keep a whole import tree in its head, and magically decide for you where any changes in the dictionary should end up. I took about a day to realize that thence lay only nasty pointed teeth (I should have realized sooner).
<br><br>So after thinking about what simplifying assumptions I can make, I have a basic design that I&#39;m kinda proud of. I&#39;ll try to explain it below, and to keep the &quot;just LOOK at how hairy the problems are if you don&#39;t do it my way&quot; details to a minimum. Trust me, they&#39;re hairy. Nonetheless, I know y&#39;all need no map from me, if you see another path, or a minor modification, which still avoids the hair and teeth, by all means, suggest it. Also speak up if you see some hair on my path I&#39;ve missed, of course.
<br><br>Summary: <br>1-As discussed already, any identifier or keyword with a translation is presented in user&#39;s preferred language on screen, but in English on disk.<br><br>2-The identifier-translating dictionary for any given file - say, &quot;
somemodule.py&quot; - stays in a parallel file in the same directory, say &quot;.someModule.p4n&quot;.<br><br>2a- The editor would have to understand import statements and have the ability to fine the relevant .p4n&#39;s. &quot;from&quot; and &quot;as&quot; modifiers would be ignored, except when combined, because even a single imported item could carry with it all the identifiers.
<br><br>3-This dictionary ONLY contains translations for the &quot;public interface&quot; of somemodule.py, that is, those identifiers which are used in importer modules. It also defines a single, unchanging &quot;preferred language&quot; for that file, which is the assumed language for all non-translated identifiers in that file.
<br><br>4-There is good UI support for creating a new translation for a word. However, the assumed user model is that words will be translated INTO a users preferred language; FROM the context of an importer module (you&#39;d generally not add translations for a module from that module itself, since generally you wouldn&#39;t even have modules open whose preferred language is not your own); and therefore WITH an explicit user decision as to which module this translation belongs in (they want to use their language for identifier X which is in English, well, they must have had a reason to write it in English rather than their language so they presumably know what imported module it comes from.)
<br><br>5-As a consequence of points 1 and 4, when you add a translation to a module whose preferred language is not English, that results in a change on-disk of the python code for that file. (Unlike the case for adding a translation for a file whose preferred language is English, which only anywhere results in safe on-screen changes). To enable the EDITOR to intelligently propagate these changes to other importers of the changed module, and the INTERPRETER to dumbly continue to work for these other importers before the editor gets to them, the changed file (and its dictionary) is given a new name (for instance &quot;
<a href="http://importedmodule.i18n.v1.py">importedmodule.i18n.v1.py</a>&quot;). The old version is not deleted and keeps the old name.<br><br>6. Due to the notable disadvantages of point 5 (polluting the filesystem and, worse, the import/pythonpath namespace with old versions, whereas the best version of a file would always have a name like &quot;
<a href="http://importedmodule.i18n.v37.py">importedmodule.i18n.v37.py</a>&quot;), there would be one change to the python core to facilitate cleanup. If someone deleted all the old copies and renamed the aforementioned best version to just 
importedmodule.py again, the default __import__ function would know how to find it when it couldn&#39;t find <a href="http://importedmodule.i18n.v37.py">importedmodule.i18n.v37.py</a>. This new feature would have no impact on any existing python code, and, to be honest, I think that its presence in the &quot;changes in python3001&quot; lists would be (minor but useful) propaganda for the new i18n features.
<br><br>(obviously, a good delinting tool would take care of all the issues created by 5 at once.)<br><br>7. Docstrings and comments, as always, are a separate issue, but I think that they&#39;re also a soluble one.<br>.................
<br><br>Is all this clear? Do y&#39;all understand why it&#39;s necessary? Do you have any other ideas, or see problems with the above that I missed? Do you think I&#39;ve made any intolerable or unnecessary compromises? Or do you just think that it&#39;s absolutely brilliant?
<br><br>Cheers,<br>Jameson Quinn<br>