Sponsors



Go Back   Zune Boards > Zune Discussions > Zune Games > Development Discussions

New Member?



 
Register Zunecentive FAQ Members List Calendar Search Today's Posts Mark Forums Read

Development Discussions All developers who are coding games may stop by here for any help, suggestions, and everything development related.

Reply
 
LinkBack Thread Tools
Old 06-14-2008, 11:27 AM   #1 (permalink)
zB Programmer
Experienced Member
 
LedZepp's Avatar
 
Join Date: Mar 2007
Posts: 973
Reputation: 116
$zB: 633
Donate
Default Supporting Several Languages in Your Game

Does your game feature the music player, but it crashes/doesnt show some characters with songs that arent titled in English? Or maybe, you just want to make a game that is in your native language.
Adding font support for other languages is quite easy.

1) Open your *.SpriteFont file in XNA Studio
2) Go to the bottom of the file and find these lines (I had to put the quotes in otherwise the browser parses them as characters)
Code:
<CharacterRegions>
     <CharacterRegion>
        <Start>&#"32;"</Start>
        <End>&#"126;"</End>
     </CharacterRegion>
</CharacterRegions>
What that says is, load up the unicode characters from ASCII 32(space) to 126(~)
3) Now this depends if you want to just support other languages including English, Include several languages but not English, or Include just 1 language

What you have to do now either way, Is find the languages ASCII codes(I have include some languages for reference and the bottom of this Post)

4) Ok so you want English, and other languages, Make sure you found the ASCII codes, and heres how to proceed:
Code:
     <CharacterRegion>
        <Start></Start>
        <End></End>
     </CharacterRegion>
Copy that and paste it into your *.SpriteFont file like so:
Code:
<CharacterRegions>
     <CharacterRegion>
        <Start>&#"32;"</Start>
        <End>&#"126;"</End>
     </CharacterRegion>
     <CharacterRegion>
        <Start></Start>
        <End></End>
     </CharacterRegion>
</CharacterRegions>
(Note, The first Character Region is English, so if you want english and more, you leave that one in and you add onto that, If you dont want english just remove the <CharacterRegion><Start>32<end>126</CharacterRegion> stuff)

Now Reference back to the ASCII codes you found and select the first character out of that languages table(For this example I will use Russian(Cyrillic)
The first character is А(&#"1040;"), So now go back to your SpriteFont file and paste that Numerical Code(&#"1040;") without the quotes of course, into the <Start> region as that is where the program will start looking for the characters
Now go to the last character in the ASCII table and copy the Numerical Code and paste it into the <End> region.
The final output should be
Code:
<CharacterRegions>
     <CharacterRegion>
        <Start>&#"32;"</Start>
        <End>&#"126;"</End>
     </CharacterRegion>
     <CharacterRegion>
        <Start>&#"1040;"</Start>
        <End>&#"1103;"</End>
     </CharacterRegion>
</CharacterRegions>
(Without the quotes)
Now, If you want your whole program to be in the languages you want(say you want the string that reads Level to say it in your language) you will have to manually go into the code and rewrite it in the unicode characters(If you try to take the english ASCII codes out and just leave the string in english you will get an error)
Now if you want more than 2 languages you can just add another
Code:
     <CharacterRegion>
        <Start></Start>
        <End></End>
     </CharacterRegion>
after the last one.

And your done!

*Slight problem with this, if you add alot of languages, or one that is really big, the Loading time of your program will be very big as it has to parse all those characters into the memory
**You can avoid the above a little by just adding the characters that will be used in your game, of course if your doing it for the music player in your program, you never know what song names other people have so you would have to include from beginning to end
***You only need to do this for a music player(If you even are doing this) if you write out the song name to a string, if you dont show the player the name of the song dont worry about this


Some language ASCII Codes:
Czech, Slovak, and Slovenian | French | German | Greek | Hawaiian | Italian | Polish | Romanian | Russian (Cyrillic) | Spanish | Turkish




LedZepp is offline   Reply With Quote
Remove Advertisements Sponsored Links
Advertisement
 
Reply


Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


Register and remove this ad

All times are GMT -8. The time now is 12:25 PM.

 
Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.2.0 RC8
vB Ad Management by =RedTyger=
(C) ZuneBoards 2006-2007
Copyright © 2006 - 2008 Zune Boards | About Zune Boards | Legal | A member of the Crowdgather Forum Community