add language localization tools

This commit is contained in:
Chris Danford
2005-12-28 19:21:08 +00:00
parent 76e78a1bc4
commit b42d28af34
14 changed files with 312 additions and 34 deletions
+16
View File
@@ -193,6 +193,22 @@ bool SMPackageUtil::LaunchGame()
return true;
}
RString SMPackageUtil::GetLanguageDisplayString( const RString &sIsoCode )
{
const LanguageInfo *li = GetLanguageInfo( sIsoCode );
return ssprintf( "%s (%s)", li ? li->szIsoCode:sIsoCode.c_str(), li ? li->szNativeName:"???" );
}
RString SMPackageUtil::GetLanguageCodeFromDisplayString( const RString &sDisplayString )
{
RString s = sDisplayString;
// strip the space and everything after
size_t iSpace = s.find(' ');
ASSERT( iSpace != s.npos );
s.erase( s.begin()+iSpace, s.end() );
return s;
}
/*
* (c) 2002-2005 Chris Danford
* All rights reserved.