Pro Yearly is on sale from $80 to $50! »

করো: Translating Code to Other (Human) Languages, and Back Again

করো: Translating Code to Other (Human) Languages, and Back Again

Javascript runs on nearly any platform. Most languages can compile to Javascript. It’s well-positioned to become the lingua franca of programmers, with one problem: Like most programming languages, Javascript is based on English. 89% of the world’s population doesn’t speak any English. Many of those people can’t even read the Latin script. If we want Javascript to be a lingua franca, we need to ensure it is accessible to all people, regardless of their native language.

Let’s look at the barriers that non-native speakers face when contributing to OSS Javascript projects and what it would take to remove them entirely, so that two developers could collaborate without speaking the same language. We will see what techniques Javascript can borrow from other languages by taking a look at করো (koro), a project which adds Bengali support to the Go compiler. And, we will learn enough about compilers and character encoding to answer the eternal question: “Could we do this in Javascript?”

94dcff33cbdf74b5d785369ac54bc1a8?s=128

Aditya Mukerjee

June 01, 2019
Tweet

Transcript

  1. : Translating Code to Other (Human) Languages and Back Again

    @chimeracoder Aditya Mukerjee Systems Engineer, Stripe
  2. 95% of the world doesn’t speak English as their first

    language 89% of the world doesn't speak English at all @chimeracoder
  3. Software is eating the world @chimeracoder (and Javascript is eating

    software)
  4. @chimeracoder Software is a powerful enabling force Software reflects the

    people who build it
  5. None
  6. “I would have thought it would be useful to NATO,

    because they had the common verbs for the things they were going to do. And the nouns, they’d just have to have a dictionary for things they were referring to for inventory control…. They’d have common nouns throughout NATO, and they could make a dictionary of common verbs and translate the program. You could write one in English and you could translate it and it could go to [the other language]. No problem, you’d have communication. It would be a limited vocabulary.” - Grace Hopper @chimeracoder
  7. github.com/ChimeraCoder/koro (koro)

  8. package main import "fmt" func main() { if true {

    fmt.Printf(“hello, world!\n") } } @chimeracoder
  9. main "fmt" main(){ true { fmt.Println(”hello, world!!\n") } } @chimeracoder

  10. @chimeracoder

  11. <insert gif of translation>

  12. gofmt korofmt @chimeracoder

  13. None
  14. Automatic source code translation • Bidirectional translation layers • Localize

    source code as a commit hook @chimeracoder
  15. Structuring Code

  16. Naming Schemes @chimeracoder readFoo() writeFoo() then() (etc.) foo () foo

    () () …
  17. Could we do this in Javascript?

  18. Character encoding Go: • Source code is required by the

    language spec to be UTF-8 • Strings (and byte arrays) are internally treated as UTF-8 JavaScript: • Source code can have any encoding supported by the interpreter • JavaScript: Strings are internally treated as... uhhh… wait… …what?
  19. @chimeracoder

  20. Could we do this in Javascript?

  21. Could we do this in Javascript? ¯\_()_/¯

  22. Localizing Error Messages

  23. type error interface { Error() string } @chimeracoder

  24. @chimeracoder Cannot cast parameter type from type “System.String” to argument

    type “System.String” Uncaught SyntaxError: Unexpected token ILLEGAL
  25. The only thing worse than a cryptic error message is

    a cryptic error message in a foreign language that you can’t understand @chimeracoder
  26. Where do we go from here?

  27. 95% of the world doesn’t speak English as their first

    language 89% of the world doesn't speak English at all @chimeracoder
  28. Aditya Mukerjee @chimeracoder https://github.com/ChimeraCoder