Friday, February 28, 2025

Localization

As I continue on my Journey in creating my first game on steam I quickly learned how important it is to localize the game by adding different languages. I decided to start with Spanish because I felt that I could handle this one mostly on my own by using google translate and then I will have someone who speaks Spanish review once I am done.

I created a very simple csv file with two columns, one column for the key and one column for the word value.

SPANISH:
name,nombre
score,puntaje
lines,pauta
level,nivel
combo,combinación
english,inglés
spanish,español

ENGLISH:
name,name
score,score
lines,lines
level,level
combo,combo
english,english
spanish,spanish

I'm using a simple method to load the data based on the language selection 'en' or 'es'

void ley::LanguageModel::loadLanguageData(std::string language) {
//load config
std::string fileName = "./assets/lang/" + language + ".csv";
std::ifstream inFile(fileName);
mLanguageFields.clear();

if (inFile.is_open())
{
std::string line;
while(std::getline(inFile,line) )
{
std::stringstream ss(line);

std::string field, word;
std::getline(ss,field,',');
std::getline(ss,word,',');

mLanguageFields.emplace(field, word);
}
}
}


I created a gitWord() method that handles the actual work of pulling the correct word based on the language setting.

getWord("programming", 0, false, capitalizationtype::capitalizeWords)


The first parameter is the key for the word, the second is a padding value, the 3rd whether the word should be left or right justified and the 4th a capitalization style.

enum class capitalizationtype {
capitalizeFirst,
capitalizeWords,
capitalizeNone
};


You can capitalize the first word in the string, all words in the string or none.

I've completed all the work for the Spanish language and the language option is available in the options menu. I'm currently working on deploying this release.

Next I will add some functionality to use the Steam SDK to detect the users language based on their Steam preferences and automatically selected the users language. I will also work on Simplified Chinese because a large portion of steam users are on Simplified Chinese.

Saturday, July 6, 2024

The beginning.

Later On

I started to learn how to program when I was about 10 years old. My grandfather gave me a TRS 80 Color Computer 2 that he purchased at an auction and I started to write my first few lines of code using Color BASIC. I remember taking my Color BASIC book over to my Dads and asked him if I can program on his computer too. I quickly learned that my Color BASIC commands were not working for the MS BASIC that he had running on his computer so he provided me with the MS BASIC book. I was a bit discouraged as I instantly become overloaded by the fact that there was more than one BASIC language.

Game Development

I developed an interest in computing at a very early age. When I was in the 8th grade I traded a handful of my games about 7 or so for the original Final Fantasy. I still remember how upset my mother was because I had traded so many games for a single one, but I didn't need any other games at that time. I was inspired by Final Fantasy and as I was playing through it I decided I would like to make a game like Final Fantasy. I wanted to develop the monsters and the hit points and everything else that it takes to make an RPG game.

 

 


Wednesday, June 24, 2015

Thursday, September 17, 1987

The Start

When I started the second grade the teacher told us about how he spent the entire summer rebuilding a handful of computers that were donated. He went on to open the partition between our classroom and the computer lab as they were separated by a set of sliding partitions. I remember when he first started to open that partition I saw a bunch of computers all of which were IBM 5150s and it was as if they were talking to me. I knew at that moment that computers were my calling.

We went into the lab and the teacher made it clear that he wanted us to wait for his instructions as he gave them one by one. He instructed us to turn on the computer and as I watched it loading I started to become engrossed by the machine. I continued to starting running commands on the computer, first DIR then I found a program to run and ran the program. The teacher walked by, impressed that I was able to start a program but also reiterating to me to follow the instructions. I was asked to exit that program and load a different one as he was instructing the class to start with a different program.