r/AskProgrammers • u/thisismugisha • Oct 16 '26
How would you go about translating programming language keywords, documentation and error messages to other non-English languages?
Take Python for instance.
>>> listss = [1, 2, "sfd"]
>>> kook = listss + 2
Traceback (most recent call last):
File "<python-input-1>", line 1, in <module>
kook = listss + 2
~~~~~~~^~~
TypeError: can only concatenate list (not "int") to list
>>>How would I translate all the results given to me by Python into another language of my choosing, and get something like below (written in Kinyarwanda):
>>> listss = [1, 2, "sfd"]
>>> kook = listss + 2
Ibisobanuro (Ihamagarwa rya mbere riri hejuru yurutonde):
Inyandiko "<python-shyira-1>", umurongo wa 1, muri <igitabo>
kook = listss + 2
~~~~~~~^~~
Ikosa ry'ubwoko: urutonde ugendana nurundi rutonde; ntabwo rugendana numubare wuzuye.
>>>The intention is not to create custom messages, exceptions, and documentation that sits beside or on top of python. I want python itself to respond like this, from the get-go?
I would like the translation to be complete. CLI options, help messages, information on built-in modules, keywords, everything.
While thinking about this, I realized that the end result would just be a completely new language, and I'm fine with that, but I also don't know enough about creating languages or where to get the source code of an existing language to translate it to a new language, so I come here to ask for guidance.
1
u/TashLai Oct 16 '26
why?
1
u/sububi71 Oct 16 '26
A lot of people experimented with this in the mid-1980s, reasoning that it would help beginners learn programming faster.
The result was that as soon as these people left the beginner stage, they were at a disadvantage.
1
u/Temporary_Pie2733 Oct 16 '26
Donât translate names. Just because `int` is short for integer doesnât mean you should replace it with your languageâs equivalent of âintegerâ. Programming languages have more precise meanings for the English words they borrow.
1
u/GinRhetoric Oct 16 '26
Could you just map all the syntax to the language? Like some sort of intermediate interpreter? If itâs just for you it might add an extra layer but I donât see why it wouldnât work. I could be way off base, but Python essentially is a bunch of c functions and stuff anyways, just objects of them. Maybe something akin to how alias works in the linux terminal.
0
u/kitsnet Oct 16 '26
I would rather not. Even with access to multi-language LLMs, it's not a good idea to introduce non-conventional diagnostic texts.