/** * Set the locale to return localized strings based on the region. * * Only certain localizations are available depending on the region. * * For a complete list of available regions and locales go to: * https://dev.battle.net/docs/read/community_apis * @param string $locale The locale to use in responses. */ public static function setLocale($locale) { try { if (is_null(self::$region)) { throw new BattleNetAPI_Exception('The method setRegion() must be called first before you can call setLocale().'); } if (!is_string($locale)) { $localeVarType = gettype($locale); throw new BattleNetAPI_Exception('The method setLocale() expects the parameter $locale to be a string, ' . $localeVarType . ' given.'); } if (!in_array($locale, self::$_regionLocales[self::$region])) { throw new BattleNetAPI_Exception('The locale "' . $locale . '" is not available in the "' . self::$region . '" region. Must be one of the following: ' . implode(', ', self::$_regionLocales[self::$region])); } self::$locale = $locale; } catch (BattleNetAPI_Exception $exception) { $exception->showMessage(); } }