Blog Post

Small Basic Blog
1 MIN READ

Multi-Language Programming in Small Basic

NonkiTakahashi's avatar
NonkiTakahashi
Iron Contributor
Feb 13, 2019
First published on MSDN on Dec 07, 2015

Authored by Nonki Takahashi


I'd like to introduce three multi-language programs for answering a forum thread: How i can add multi language program ? asked by MehmetTR.


The first one is the easiest TextWindow sample.  The array msg is for multi-language texts.  You can get n th text as msg[n][lang], while lang is a language id.  I used ISO 639-1 language code for the id.



langList = "en=English;de=Deutsch;"

msg [ 1 ] = "en=Good Morning.;de=Guten Morgen.;"

msg [ 2 ] = "en=Good Afternoon.;de=Guten Tag.;"

msg [ 3 ] = "en=Good Evening.;de=Guten Abend.;"

While "True"

error = "True"

While error

TextWindow . Write ( "Language: " )

TextWindow . Write ( "1 (" + langList [ "en" ] + ") or " )

TextWindow . Write ( "2 (" + langList [ "de" ] + ")? " )

num = TextWindow . ReadNumber ( )

If num = 1 Then

lang = "en"

error = "False"

ElseIf num = 2 Then

lang = "de"

error = "False"

EndIf

EndWhile

TextWindow . WriteLine ( msg [ 1 ] [ lang ] )

TextWindow . WriteLine ( msg [ 2 ] [ lang ] )

TextWindow . WriteLine ( msg [ 3 ] [ lang ] )

EndWhile


The second one BGF911-2 supports 20 languages.  I modified Jibba Jabba's Drop Down Menu System for this program.



The last one is a game Small Quest (alpha version).  This game supports three languages and reads texts from files (*en-US.dat, *ja-JP.dat or *pt-BR.dat).



Let's create international programs!

Published Feb 13, 2019
Version 1.0
No CommentsBe the first to comment