Open Source Cross-Platform Game Programming

Project Gengo is an attempt to translate Crayon into non-English languages. More importantly, it is an attempt to do so without branching/fracturing the code or community, but rather created a unified ecosystem, regardless of locale. In specific terms, this is providing a true officially-maintained string-table-based localization of not just the programming language, but also make it easy for library authors to do the same for their public-facing API's.

The intent is to make Crayon feel like a programming language that was natively written with other spoken languages in mind, regardless of whether it’s syntax, libraries, or online resources. As a language that was designed to be easy to learn for first-time programmers, the ultimate goal is to reduce the barrier of entry to programming for non-English audiences.

The problem of third-party libraries

Translating the syntax for a programming language is easy, since this is a distinction that only needs to be made in the compiler. But the major problem in translating a programming language is its libraries, both built-in and third-party. Without providing a means to allow library authors to easily localize their public-facing API’s without providing multiple versions of the same code, a language is not truly localized.

Crayon provides this ability through the @localized annotations that can be added to any user-defined entity, such as a class, method, constant, enum, or function.

@localized('es', "Graficos")
@localized('jp', "グラフィックス")
namespace Graphics {
    @localized('es', "Ventana")
    @localized('jp', "窓")
    class Window {
        constructor(width, height) { ... }
        ...
    }
}

The implementation of the Window class would stay the same, posing little maintenance burden on the library provider. The user, depending on the locale of their project, can import the library and use it in any language that the library supports.

In English:

import Graphics;
...
myWindow = new Graphics.Window(600, 400);

In Spanish:

entablar Graficos;
...
miVentana = crear Graficos.Ventana(600, 400);

In Japanese:

参照 グラフィックス;
...
私の窓 = 生成 グラフィックス.窓(600, 400);

And of course, all 3 of these code samples are importing the same library.

Non-English programming language dilemma

While non-English programming languages are nothing new, one of the main barriers for non-English programming languages to gain traction is the fact they are very focused on a specific audience and furthermore are likely to focus on a specific platform (such as only running in a specific environment or requiring users to download their VM). Because they are generally narrowly focused in purpose or audience, it is uncommon for libraries to be written for these languages. Because a language is generally only as powerful as the libraries it supports, this creates a cycle that hinders adoption, even in the country it was intended for.

By making libraries interoperable between locales, this prevents developer isolation. If a library is not supported by a certain locale, it gracefully falls back to the default language (such as English), and the developer is in no worse condition than the current state of the world.

How to use it

Project Gengo is enabled in the most recent 0.2.1 preview release (but is not available in the 0.2.0 release). However the best way to test it is by building the compiler from source directly from the master branch, to ensure that you have the most recent translations.

When you run Crayon from the command line you can use the -genDefaultProjectES and -genDefaultProjectJP flags to generate a project that is set up with the Spanish or Japanese locales. When you import libraries from these projects, it’ll automatically use the translated version of the Crayon libraries.

How to help

I’ve written a translation guide/process that both explains how to contribute and some of the language specific considerations.

The easiest way to help is to provide translations. While I know a little about a few languages, I am not fluent and I’m always looking for help from those that are more familiar with these languages. I’ve only focused on Spanish and Japanese due to my own familiarity of those languages and current location, but am looking to add translations for other languages as well.

I am also interested in translating tutorials and documentation, but because the current state of things are in flux, I would like to wait a little longer before focusing time on this, as most tutorials would need to change multiple times in the near future.

Even if you don’t know any languages other than English, other ways to help include just using Crayon as a language in English. Finding bugs and reporting issues helps general stability which helps everyone.

Contact

If you have questions, please contact me either through twitter, the mailing list, or any other channels listed at the bottom of the page.