|
  
|
|
|||||||
| Development Discussions All developers who are coding games may stop by here for any help, suggestions, and everything development related. |
![]() |
|
|
LinkBack | Thread Tools |
|
|
#1 (permalink) |
|
zB Programmer
Experienced Member Join Date: Mar 2007
Posts: 973
Reputation: 116
Donate |
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>
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>
Code:
<CharacterRegions>
<CharacterRegion>
<Start>&#"32;"</Start>
<End>&#"126;"</End>
</CharacterRegion>
<CharacterRegion>
<Start></Start>
<End></End>
</CharacterRegion>
</CharacterRegions>
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>
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>
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 ![]() |
|
|
|
| Remove Advertisements Sponsored Links | |
Advertisement |
|
![]() |
| Thread Tools | |
|
|
| |