Welcome, Guest. Please login or register.

Login with username, password and session length

 
Advanced search

1411678 Posts in 69399 Topics- by 58453 Members - Latest Member: Arktitus

May 17, 2024, 09:23:39 AM

Need hosting? Check out Digital Ocean
(more details in this thread)
TIGSource ForumsDeveloperTechnical (Moderator: ThemsAllTook)Localization
Pages: [1]
Print
Author Topic: Localization  (Read 2185 times)
Average Software
Level 10
*****

Fleeing all W'rkncacnter


View Profile WWW
« on: March 27, 2010, 09:44:15 AM »

I'm starting a new project, and with every project I do, I start it with the intent to do something I've never done before.  This time, that something is localization.

I've done some localization stuff on Mac OS X before for my job, so I have a rough idea of how it works there, but for Linux(Gtk) and Windows I only have a few vague ideas.

Has anyone ever done this before, and if so, what techniques and resources did you find useful?
Logged



What would John Carmack do?
Skofo
Level 10
*****



View Profile
« Reply #1 on: March 27, 2010, 10:37:50 AM »

Use associative arrays?

Code:
text.english = {
  'victory': 'VICTORY!',
  'loss': 'I lost... D='
}
text.japanese = {
  'victory': '勝利!',
  'loss': '道に迷って。。。 (ιยดД`)'
}
Logged

If you wish to make a video game from scratch, you must first invent the universe.
Average Software
Level 10
*****

Fleeing all W'rkncacnter


View Profile WWW
« Reply #2 on: March 27, 2010, 12:55:29 PM »

I should probably clarify that I'm looking for the official OS sanctioned localization techniques.
Logged



What would John Carmack do?
increpare
Guest
« Reply #3 on: March 27, 2010, 03:06:35 PM »

My main recommendation would be that you pick one particular unicode file-type and be very careful to only use it.  Oh man the pains I've had with file types are not inextensive!

As for the rest, here's what comes to mind - I'm guessing you're familiar with a lot of this stuff, but just in case...

Unreal engine uses INI files for everything.  Seems harmless enough (with the gotcha that you can't encode newlines directly - you end up having to pick some other character instead).  I've used plain-text files as well, or lua scripts.  XML would probably be as good if not better.

One other thing to be careful about for games is font-usage.  Make sure you're using a font that has all the requisite characters (or if it doesn't make sure you have the ability to swap around fonts mid-game), and that you won't run into memory issues when rendering large quantities of strange characters.

Other obvious things are: right-to-left support, supporting the (relatively) weird entry methods of asian languages.

Are you going to be doing voice-localization as well?  If so, you might be able to get by with subtitles (which are good to do from an accessibility standpoint anyway).  If you're interested in subtitling, the BBC guidelines are absolutely fascinating.

Will you localize time/date/number formatting?  If you're using C/C++, you gotta be careful about locale support - the locale settings will be by default based on the system settings IIRM, so if the two go out of sync it can be weird.

Apple has some good localization guides on-line, that offer the following advice that's almost useless for a lot of games, along the lines of "never concatenate two strings, never substitute one string inside another, never substitute a number inside of a string", &c..  

Other things: be careful of capitalization!  What letters get capitalized to what letters depends on the language (check out Turkish), and sometimes one lower-case letter gets capitalized to two upper case ones  (β->SS in German).

Texture localization might also be required.

Also: learn what unicode is if you don't already know.

Also: for UI design, give yourself a lot of space - strings will expand a lot in other languages.  A rule of thumb is to allow for everything to expand by 1.5x.

Also: be sure that whoever's translating has access to the game, so that they can see text in context.

Also: be careful about reusing localized strings in several places - if 'back' is on a button, when translating into other languages it might get translated into one of several words depending on its particular function.  Best to be on the safe size and duplicate strings that are identical in english rather than to have really awkward-seeming translations.

Also: I'd recommend at least considering the setting up of a type system that would enforce that only localized strings find their way into on-screen text (or at least some tests that make sure that there aren't any), by having a special localized_string class, say.

Also: with regards to input, allowing users to reconfigure their input is a must, and ideally you'd want different default keyboard layouts for the various languages you might support (messing with scancodes/key codes isn't worth the hassle).

For any text talking or referring to the player or their character(s), you are going to have to consider having 2 versions depending on the gender of the player/their character.
« Last Edit: March 28, 2010, 03:23:08 AM by increpare » Logged
hexageek
Level 0
***



View Profile
« Reply #4 on: March 28, 2010, 02:23:55 AM »

check out: http://www.pango.org/
also http://www.transifex.net/ works with *.po files so you can collaboratively translate your games.
Logged
mcc
Level 10
*****


glitch


View Profile WWW
« Reply #5 on: March 28, 2010, 09:54:07 PM »

What I'd be most interested in is one routine or set of routines that would allow me to figure out what the default language is for whatever machine I currently happen to be on. There's probably a lot of options once you know which language to use, but figuring out what language the OS thinks I should be using seems like the hard step. Does Pango or Transfix offer that?

And I kinda suspect I could figure out how to do this myself on Mac and Windows, but I have no idea how Linux decides what the current language is. Does Linux even have a standard concept of "current localization", the way Mac and Windows do?
Logged

My projects:<br />Games: Jumpman Retro-futuristic platforming iJumpman iPhone version Drumcircle PC+smartphone music toy<br />More: RUN HELLO
Average Software
Level 10
*****

Fleeing all W'rkncacnter


View Profile WWW
« Reply #6 on: March 29, 2010, 04:47:32 AM »

What I'd be most interested in is one routine or set of routines that would allow me to figure out what the default language is for whatever machine I currently happen to be on. There's probably a lot of options once you know which language to use, but figuring out what language the OS thinks I should be using seems like the hard step. Does Pango or Transfix offer that?

And I kinda suspect I could figure out how to do this myself on Mac and Windows, but I have no idea how Linux decides what the current language is. Does Linux even have a standard concept of "current localization", the way Mac and Windows do?

Gtk (glib specifically) has a function called g_get_language_names() that returns the locales in order of preference.  Right now I'm using this and loading the glade file that corresponds to the preferred language, and it seems to be working well.  I haven't done the research for Mac/Windows yet, but I'm sure that something exists.
Logged



What would John Carmack do?
Chromanoid
Level 10
*****



View Profile
« Reply #7 on: March 29, 2010, 04:57:40 AM »

In java you usually use http://java.sun.com/javase/6/docs/api/java/util/ResourceBundle.html + http://java.sun.com/javase/6/docs/api/java/util/Locale.html

I think in .Net/Windows-Development you use different Resource files with the following Naming pattern <basename>[.<culture>].resources. I think for Forms there is some extra logic...
Logged
mcc
Level 10
*****


glitch


View Profile WWW
« Reply #8 on: March 30, 2010, 08:52:06 AM »


Gtk (glib specifically) has a function called g_get_language_names() that returns the locales in order of preference.  Right now I'm using this and loading the glade file that corresponds to the preferred language, and it seems to be working well.  I haven't done the research for Mac/Windows yet, but I'm sure that something exists.
Ooh, very neat. Do you know if this works correctly on machines which use KDE rather than GNOME as their primary desktop environment?
Logged

My projects:<br />Games: Jumpman Retro-futuristic platforming iJumpman iPhone version Drumcircle PC+smartphone music toy<br />More: RUN HELLO
mjau
Level 3
***



View Profile
« Reply #9 on: March 30, 2010, 09:49:18 AM »

In Linux you can just get the value of the environment variable LANG, and maybe fall back to LC_ALL or LC_MESSAGES/LC_CTYPE or LANGUAGE if that fails (though it shouldn't).  The format of all of those is language_location.encoding, where language is an ISO 639 code and the rest is optional.  Pretty much everything uses two-character ones (639-1), so go with that.  (It may also be just "C", which means default, or english.)

This works independently of window manager.  It even works in pure text mode.

There's also some c functions you can use to get number separators and that kind of thing.  See the manpage for locale (section 7) for more info bout that.  (Also there's the gettext system for getting localized strings, but this requires working with external .po files and personally i think it's better to just make up your own system, it's all based on the environment variables anyway.  Lua tables work great.)
Logged
Average Software
Level 10
*****

Fleeing all W'rkncacnter


View Profile WWW
« Reply #10 on: March 30, 2010, 05:11:57 PM »


Gtk (glib specifically) has a function called g_get_language_names() that returns the locales in order of preference.  Right now I'm using this and loading the glade file that corresponds to the preferred language, and it seems to be working well.  I haven't done the research for Mac/Windows yet, but I'm sure that something exists.
Ooh, very neat. Do you know if this works correctly on machines which use KDE rather than GNOME as their primary desktop environment?

Gtk is independent of the desktop environment.  I use both KDE and Fluxbox, and have tested on XFCE, WindowMaker, and GNOME.  It might even work on Windows/Mac, but I'm not using Gtk there.

In Linux you can just get the value of the environment variable LANG

The Gtk function I mentioned is clearly pulling from LANG, but it also contains some extra information like secondary and tertiary locales and so forth.  My LANG doesn't have that information, so I'm not sure where it's getting it from.

Almost all of my text is contained in the GUI.  This particular game is built entirely from standard GUI components, so I'm just loading custom GUI files for each language.  This seems like the easiest way to handle it.  I may need a few small string tables, but not much.
Logged



What would John Carmack do?
increpare
Guest
« Reply #11 on: March 30, 2010, 05:39:54 PM »

Wow I totally misread your question.  Apologies.  

nobody's answered the windows-specific question I see - there it's GetLocaleInfoEx you'll need, together with the usually windows api-style cast stuff that microsoft love.

Oh wait, I see GetUserDefaultUILanguage is rather more straight-forward and might be more-appropriate.
« Last Edit: March 30, 2010, 05:52:59 PM by increpare » Logged
Average Software
Level 10
*****

Fleeing all W'rkncacnter


View Profile WWW
« Reply #12 on: March 30, 2010, 06:03:14 PM »

Wow I totally misread your question.  Apologies. 

nobody's answered the windows-specific question I see - there it's GetLocaleInfoEx you'll need, together with the usually windows api-style cast stuff that microsoft love.

Oh wait, I see GetUserDefaultUILanguage is rather more straight-forward and might be more-appropriate.

Thanks, I'll investigate those later.

On the Mac it's basically as easy as having a xib file for each language, at least as far as I know.  I should see how my project at work does it, although I think we might be a touch outdated, since I think this recently changed.
Logged



What would John Carmack do?
Pages: [1]
Print
Jump to:  

Theme orange-lt created by panic