ReXGlue SDK
Loading...
Searching...
No Matches
language.h File Reference

Mapping of host locales to title languages. More...

#include <cstddef>
#include <memory>
#include <unordered_map>
#include <vector>
#include <format>
#include <string>
#include <filesystem>
#include <optional>
#include <string_view>
#include <functional>
#include <span>
#include <rex/platform.h>
#include <rex/types.h>
#include <rex/memory.h>
#include <rex/kernel/types/status.h>
#include <rex/memory/stream.h>
#include <rex/kernel/types/content.h>
#include <rex/result.h>
#include <rex/filesystem/xdbf.h>
#include <rex/utility.h>
#include <rex/module.h>
#include <rex/title.h>
#include <rex/ui/window.h>

Go to the source code of this file.

Classes

class  rex::xam::IXAMLanguage
class  rex::xam::XAMLanguage

Namespaces

namespace  rex

Functions

REX_XAM_API rex::kernel::XLanguage rex::xam::GetLanguageForLocale (const ui::HostLocale &locale)
REX_XAM_API rex::kernel::XLanguage rex::xam::GetLanguageForLocales (std::span< const ui::HostLocale > locales)
REX_XAM_API std::string_view rex::xam::GetLanguageName (rex::kernel::XLanguage language)
REX_XAM_API rex::kernel::XLanguage rex::xam::ParseLanguageCode (std::string_view code)

Detailed Description

Mapping of host locales to title languages.

Xenia : Xbox 360 Emulator Research Project *

Copyright 2014 Ben Vanik. All rights reserved. * Released under the BSD license - see LICENSE in the root for more details. *

Modified
Tom Clay, 2026 - Adapted for ReXGlue runtime
Remarks
Parts derived from Xenia (Ben Vanik, 2020).
Parts derived from Xenia (Ben Vanik, 2022).

Function Documentation

◆ GetLanguageForLocale()

REX_XAM_API rex::kernel::XLanguage rex::xam::GetLanguageForLocale ( const ui::HostLocale & locale)
nodiscard

Maps a host locale to a title language, ignoring case. Chinese goes by country, so TW, HK and MO give Traditional Chinese and anything else gives Simplified Chinese.

Parameters
localeThe host locale, language such as zh and country such as TW.
Returns
The title language, or XLanguage::kInvalid when the locale names none.

◆ GetLanguageForLocales()

REX_XAM_API rex::kernel::XLanguage rex::xam::GetLanguageForLocales ( std::span< const ui::HostLocale > locales)
nodiscard

Picks the title language of the first locale of a list that maps to one.

Parameters
localesThe locales, most preferred first.
Returns
The title language, or XLanguage::kEnglish when no locale maps.

◆ GetLanguageName()

REX_XAM_API std::string_view rex::xam::GetLanguageName ( rex::kernel::XLanguage language)
nodiscard

Returns the name of a title language as the XDK documents it for XGetLanguage. The name is such as "Chinese (Traditional)", the XDK placeholder text for kSChineseDeprecated, or "Unknown" for kInvalid and kMaxLanguages.

◆ ParseLanguageCode()

REX_XAM_API rex::kernel::XLanguage rex::xam::ParseLanguageCode ( std::string_view code)
nodiscard

Parses a language code, ignoring case. The codes are en, ja, de, fr, es, it, ko, pt, pl, ru, sv, tr, nb, no and nl with an optional region suffix after a dash or underscore. The code zh gives Simplified Chinese, or Traditional Chinese when a suffix names TW, HK, MO or Hant.

Returns
The title language, or XLanguage::kInvalid for an unknown code, including "auto".