當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript language.getLanguage函數代碼示例

本文整理匯總了TypeScript中@uifabric/utilities/lib/language.getLanguage函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript getLanguage函數的具體用法?TypeScript getLanguage怎麽用?TypeScript getLanguage使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了getLanguage函數的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: _getFontFamily

function _getFontFamily(): string {
  let language = getLanguage();
  let fontFamily = FontFamilyWestEuropean;

  for (let lang in LanguageToFontMap) {
    if (LanguageToFontMap.hasOwnProperty(lang) && language && lang.indexOf(language) === 0) {
      // tslint:disable-next-line:no-any
      fontFamily = (LanguageToFontMap as any)[lang];
      break;
    }
  }

  return `${fontFamily}, ${FontFamilyFallbacks}`;
}
開發者ID:amkronen,項目名稱:office-ui-fabric-react,代碼行數:14,代碼來源:DefaultFontStyles.ts

示例2: createFontStyles

import {
  fontFace,
  IFontWeight
} from '@uifabric/merge-styles/lib/index';
import {
  IFontStyles
} from '../interfaces/index';
import { createFontStyles, FontWeights, LocalizedFontFamilies, LocalizedFontNames } from './fonts';
import { getLanguage } from '@uifabric/utilities/lib/language';
import { IFabricConfig } from '../interfaces/IFabricConfig';

// Default urls.
const DefaultBaseUrl = 'https://static2.sharepointonline.com/files/fabric/assets';

// Standard font styling.
export const DefaultFontStyles: IFontStyles = createFontStyles(getLanguage());

function _registerFontFace(
  fontFamily: string,
  url: string,
  fontWeight?: IFontWeight,
  localFontName?: string
): void {
  fontFamily = `'${fontFamily}'`;

  const localFontSrc = localFontName !== undefined ? `local('${localFontName}'),` : '';

  fontFace({
    fontFamily,
    src:
      localFontSrc +
開發者ID:zoarif,項目名稱:office-ui-fabric-react,代碼行數:31,代碼來源:DefaultFontStyles.ts


注:本文中的@uifabric/utilities/lib/language.getLanguage函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。