機能
カスタマイズ情報に保存されているユーザのロケール情報(言語およびタイムゾーン)を取得,設定するクラスです。
使用方法
ユーザの利用言語に応じたコンテンツを作成する場合に使用します。
注意事項
カスタマイズ情報が取得できない場合に,Webブラウザの設定値を取得する場合があります。しかし,このAPIからWebブラウザの設定を変更することはできません。
メソッドの一覧
戻り値のデータ型 | メソッド | 説明 |
---|---|---|
static final String | getLangType(HttpServletRequest req) | ユーザが表示可能な言語の中で最も優先度の高い言語の識別子をISO言語コードに従った形式で取得します。 |
public static final Enumeration | getLangTypes(HttpServletRequest req) | ユーザが表示可能な言語のすべての識別子を取得します。 |
public static final String | getLanguage(HttpServletRequest req) | ユーザが表示可能な言語の中で最も優先度の高い言語の識別子を文字列表現で取得します。 |
static final String | getTimeZone(HttpServletRequest req) | カスタマイズ情報に設定されているタイムゾーンIDを取得します。 |
static final void | setLangType(HttpServletRequest req,String langtype) | カスタマイズ情報に言語IDを設定します。 |
static final void | setTimeZone(HttpServletRequest req,String timezone) | カスタマイズ情報にタイムゾーンIDを設定します。 |
public static final Locale | getLocale(HttpServletRequest req) | ユーザが表示可能な言語の中で最も優先度の高い言語に対応するロケールを取得します。 |
public static final Enumeration | getLocales(HttpServletRequest req) | ユーザが表示可能な言語に対応するロケールをすべて取得します。 |
public static final Enumeration | getSupportLocales() | uCosminexus Portal Frameworkがサポートしているすべての言語に対応するロケールを取得します。 |
public static final Enumeration | getSupportLanguagesOrder() | uCosminexus Portal Frameworkがサポートしているすべての言語の文字列表現を取得します。 |
メソッドの説明
public static final String getLangType(HttpServletRequest req)
ユーザがカスタマイズ情報に設定している言語設定 | ユーザがWebブラウザに設定している言語設定 | ||
---|---|---|---|
日本語(ja) | 英語(en) | その他の言語 | |
日本語 | ja | ja | ja |
英語 | en | en | en |
設定なし※1 | ja | en | en※2 |
注※1 ユーザがポータル画面の利用者用レイアウトカスタマイズ画面で言語を設定していない場合,およびウェルカム画面などのログイン前の画面でこのメソッドを発行した場合です。
注※2 プロパティで変更できます。
public static final Enumeration getLangTypes(HttpServletRequest req)
public static final String getLanguage(HttpServletRequest req)
public static final String getTimeZone(HttpServletRequest req)
public static final void setLangType(HttpServletRequest req,
String langtype)
public static final void setTimeZone(HttpServletRequest req,
String timezone)
public static final Locale getLocale(HttpServletRequest req)
public static final Enumeration getLocales(HttpServletRequest req)
public static final Enumeration getSupportLocales()
public static final Enumeration getSupportLanguagesOrder()