anyone know of efforts to internationalize natural...
# of-end-user-programming
c
anyone know of efforts to internationalize natural language programming languages?
d
We're aiming for that in Wikifunctions. Each function will have labels in natural languages, and you can read your code in English, German, or any of the other 300 languages of Wikimedia
e
p
I have done two small efforts in this direction. First one is to make Javascript programmable in my mother tongue using some regex hacks: https://makers-of-kerala.com/thengascript/ Another one was a plan to use Lisp macros: https://twitter.com/prathyvsh/status/635733805567840256?s=21 If you are interested in looking at such efforts, then Yor lang: https://github.com/anoniscoding/yorlang and Wenyan: https://ide.wy-lang.org/ are two nice projects. If its for a more fundamental base from which to internationalize the base language, think there was something that leveraged Jetbrains MPS platform.
c
thanks all!
k
Another programming language based on something other than English is قلب (https://github.com/nasser/---), a variant of Scheme based on Arabic. I have also seen Lisp dialects based on French, but they pre-date the Internet, so I can't offer any pointers.
👍 3
s
The TeX macro suite ConTeXt has one interface with definitions in different langauges. This uses TeX's [
\csname
](https://en.wikibooks.org/wiki/TeX/csname) macro, which allows you to call or define a TeX command by building its name from strings. Allow me to quote from Aditya's excellent explanation on the TeX Stack Exchange:
How should such a multilingual a key-value driven interface be defined?
This is where the
\c!...
and
\v!...
macros come in. (Remember that in
\unprotected
mode
!
is a letter, so
\c!something
is a macro with a name
c!something
). In the core packages, ConteXt defines
\definehead[\v!chapter][...]
This defines (amongst other things) a macro `\e!start\v!chapter`: in the English interface,
\e!start=start
, `\v!chapter=chapter`; in the French interface
\e!start=demarre
,
\v!chapter=chapitre
. Hence we get
\startchapter
and
\demarrechapitre
.
His full explanation is longer and better, I can recommend it. Some Stack Overflow QAs explaining the mechanism: • https://tex.stackexchange.com/questions/109869/what-does-s-do/110131#110131https://tex.stackexchange.com/questions/58654/context-how-do-you-create-your-own-commands/58716#58716 Relevant source files: • mult-ini.mkiv contains doc comments explaining the system • mult-def.lua contains command translations. One of them, Farsi, is a right-to-left language (actually a macrolanguage, in both senses of the word :D). Other noteworthy elements of the multilingual system: - namespaces for the system's words, because 'left' might mean 'the left' or 'leftwards'. - This implementation actually uses less CPU and RAM than the old monolingual one, because TeX commands take up less TeX tokens (1 in total) than strings (1 per letter). ---- #### Quick intro to ConTeXt for those unfamiliar with it I realise ConTeXt is nowhere near as well-known as LaTeX, so I'll briefly introduce it. Like LaTeX, it is a TeX macro suite that provides high-level typesetting constructs on top of TeX. Its development is headed by Hans Hagen, an independent publisher/designer in the Netherlands. Unlike LaTeX: - ConTeXt supports user-controlled per-document design as well as style sheets. - ConTeXt is expandable: it makes it easy to derive or define your own structural/sementic elements. For example, you could define a section type
\exercises
that inherits from
\subsection
, or a block type
\startexercise...\stopexercise
that inherits from
\startframed
. - ConTeXt is stylable: it provides commands and parameters to change the style of elements, both your own and the built-ins. - ConTeXt is consistent: setting style parameters uses a nice
key=value
syntax, and settings like
color=...
are available everywhere they make sense. - ConTeXt is integrated: fundamental typesetting concepts such as page numbering, or margin notes, or arranging multiple pages on a sheet, are all part of core. (There are third-party modules, too.) A small example: (output attached):
Copy code
\setuppapersize[A6][A5,landscape]  % A6 pages on A5 paper,
\setuparranging[2SIDE]             % arranged side-by-side

% Section heads are bold, blue, and start 3cm below previous text.
\setuphead[section]
    [color=blue,
     style=bold,
     before={\blank[2cm]},
    ]

% Our custom `redsection` inherits from `section`,
% but uses red instead.
\definehead[redsection][section]
    [color=red]

\starttext  % like \begin{document}

\section{Black, black, black...}
\startlines[style=bold]
  ...is the color of my true love's hair
  His lips are something wondrous fair.
\stoplines

\redsection{The lady in red is dancing with me...}
Cheek \color[red]{to} cheek.

\section{ʿAlī ibn Abī Ṭālib}
\input khatt-en  % Some lorem ipsum text

\stoptext
c
@Chris Martens (they/them), I'm not sure where you're going with your ask. Do mean localizing existing general purpose programming languages? Or is there a different category of "natural language programming languages"? The words used sound similar to some of our design work at Storyscript. For example, in our language, our type system encodes i18n information dependent on the data, e.g. a list type had a singular form L10nItem that must be defined wherever a list is constructed.
c
I mean “natural language programming languages” include things like COBOL, Cocoa, Inform 7, and myriad DSLs that try to afford “programming in English” (and it is usually English that I see).
c
Okay, gotcha. Yeah, we have our own structured language where all identifiers are projections of their types' localization info.
c
@Konrad Hinsen yeah I’m familiar with Ramsey’s work, but i see that as more of an Arabic-specific PL variant, rather than an attempt to “internationalize.” which, maybe it’s flawed assumption anyway to think that this is possible!
Ok, that’s pretty cool tho!
k
@Chris Martens (they/them) If you are looking for I18N applied to code, then the most popular use case is perhaps VB code in Excel spreadsheets. I have vague memories of attempts to rebase Forth on other human languages than English. Another twist is the avoidance of any reference to a human language, as in APL, but that's the opposite of what you are looking for.
c
Well, to be honest, I am a critic of “natural language” programming languages. One of my critiques is that they are difficult to internationalize — but I realized at some point that this was a baseless claim and that I needed to investigate to what extent folks had tried.
👍 1
g
@Chris Martens (they/them) AppleScript (which is quite natural-language-ish) was originally localized, but eventually support was dropped because “few app developers provided terminology in multiple languages” https://twitter.com/geoffreylitt/status/1258769298862100483
❤️ 2
🤔 1
c
Cool find! @Geoffrey Litt
d
Lojban looks like an (unintentional) attempt to redefine human language (in a culturally neutral way) in terms of Lisp. It's mainly a bunch of relations, and placeholders in those relations
c
@Dan Cook I thought Lojban was just a constructed language for human communication. Is there a facet of it being used for computer specification? I know it attempts to remove lots of ambiguity
Interesting
Lojban is proposed as a speakable language for communication between people of different language backgrounds, as a potential means of machine translation, and as a tool to explore the intersection between human language and software.
– from wikipedia. I hadn't thought of it from the software perspective.
d
There's mention of it being a good candidate for computers to process (parse, understand, translate) language because of the uniform structure. It's like a language AST
Yeah, that. You can find mention of this in various reference material, I think also in the complete Lojban language book
Lojban is such a fun research area. Thanks for reminding me of this wonderful language!
cc @Pete Vilter Lojban is a constructed language which prioritizes the ability to express concepts as relationships (like a logical language)
👍 1
k
I had looked at Lojban a long time ago (mid-1990s), and I must admit i am somewhat surprised that people are still working on it. It looks like a solution looking for a problem. Back then, there was nobody who could fluently communicate in Lojban, in spite of many people trying. It looked like a language ultimately unsuitable for human brains.
y
A bit late to this thread, but Lamdu supports switching between natural languages. Here's a short video on that:

https://youtu.be/2yGHk9XXOBE

👏 1