Yorùbá Code Translator
Write Python in Yorùbá, in English, or in both at once. Your repository keeps
plain English, so GitHub, your teammates, CI and Python itself never need to know
which language you typed in. You see your own language in your editor.
iṣẹ́ kí(orúkọ): # def kí(orúkọ):
tẹ̀jáde("Báwo, " + orúkọ) # print("Báwo, " + orúkọ)
kí("ayé")
Tone marks never matter for matching: tejade and tẹ̀jáde are the same word.
Nothing changes in a repository until you turn it on. Installing this
extension, or opening a project, does not touch Git or any file.
Before you rely on it
- Provided "as is", without warranty. You use it at your own risk. The authors are not liable for any loss or damage, including broken code or lost work. The legal terms are in
LICENSE (section 6).
- The Yorùbá words are still being confirmed with native speakers. Confirmed words are final; the others may change in
later versions. The vocabulary is built from the project's own word list and is still growing. When a word changes, the
old spelling is kept as an accepted alternative wherever possible, so files you already wrote keep converting, but
check after you update.
- Commit or back up your work first. Turning Yorùbá mode on or off rewrites the files in your clone (uncommitted
edits are kept). Do it from a clean, committed state, and look at
git status afterwards.
- You are responsible for what you ship. Only names change, and the extension refuses to convert when it is not
sure, but review and test your code. Your repository stores English, so run your tests and your build on that.
- Tried on Windows so far. macOS, Linux and remote or WSL workspaces are not verified yet.
- An independent project. Not affiliated with or endorsed by Microsoft or the Python Software Foundation.
What it does
- Turn on for this repository (Command Palette: Yorùbá: Turn on for this
repository, or click Yorùbá: off in the status bar). Commits then store
English and your files show Yorùbá. This is set in your clone only, so each
person on a team chooses their own language and nobody else is affected.
Your existing files are converted in place and any uncommitted edits are kept.
Turning it off converts them back to English first, so a plain
git commit
never stores Yorùbá.
- Convert this file to English / to Yorùbá for a single file.
- Run in Yorùbá: while Yorùbá mode is on, the run button at the top of the
editor runs your file the Yorùbá way (Python's own run option moves into the
button's dropdown). A "Run in Yorùbá" link also appears above line 1, and it
is in the right-click menu. The output stays in a terminal called "Yorùbá:
run", where you can answer
input(). Error messages show your own line
numbers. Python's own ▷ cannot read Yorùbá words.
- Colouring and error checking. While Yorùbá mode is on, the repository's
.py files open as Python (translated) (shown at the bottom right of the
window). The Python language server (Pylance) cannot read Yorùbá words, so as
plain Python these files would get red underlines and mismatched colours. As
"Python (translated)" they get the same colours as English code, the usual
editing behaviour (comments, brackets, auto-indent after bíóṣepé x:) and
syntax-error underlines on your Yorùbá text, checked by Python itself. The
trade-off: no Pylance hover, completion or go-to-definition in those files.
Turn it off with the setting yorubaSuite.translator.useOwnLanguageMode if you
prefer Pylance (and its underlines). Your English files are never affected.
- Word suggestions while Yorùbá mode is on: type
tej and get tẹ̀jáde.
- Choose language and tone marks from the same menu. Tone marks follow the
shared
yorubaSuite.tonalMarks setting.
Command line
The same engine ships as yopy (needs only Node):
yopy translate --to en file.py # Yorùbá/mixed -> English
yopy translate --to yo file.py # English -> Yorùbá
yopy run file.py # run a Yorùbá file (needs Python)
yopy git enable | disable | status # the repository setting above
Good to know
- Only Python is supported so far. HTML and CSS come later.
- Run translates the whole program: the file you run and the other
.py files
it imports (those in its folder, below it, and in PYTHONPATH). Programs that
start another Python program themselves (subprocess, multiprocessing) are
not translated.
- Words that are not yet confirmed with native Yorùbá speakers may change. Longer keywords such as
bíóṣepé (if) exist on purpose: short
words collide with ordinary variable names once tone marks are ignored (see
docs/DECISIONS-translator.md in the repository).
- If a file has a variable spelled like a Yorùbá word, the extension never
guesses: conversion explains the problem, and Git mode keeps the name as
written and notes it on the last line (
# yopy: keep name).
- The Git setting needs a runtime on your machine. It uses Node if you have it,
otherwise VS Code's own.
Installing the full suite (yoruba-development-suite) includes this extension.
License
Free to use, not to sell. See LICENSE; it includes the no-warranty terms.
| |