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


Java LocaleInfo類代碼示例

本文整理匯總了Java中com.google.gwt.i18n.client.LocaleInfo的典型用法代碼示例。如果您正苦於以下問題:Java LocaleInfo類的具體用法?Java LocaleInfo怎麽用?Java LocaleInfo使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


LocaleInfo類屬於com.google.gwt.i18n.client包,在下文中一共展示了LocaleInfo類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getDisplayName

import com.google.gwt.i18n.client.LocaleInfo; //導入依賴的package包/類
private String getDisplayName(String localeName){
  String nativeName=LocaleInfo.getLocaleNativeDisplayName(localeName);
  if (localeName == "zh_CN") {
    nativeName = MESSAGES.SwitchToSimplifiedChinese();
  } else if (localeName == "zh_TW") {
    nativeName = MESSAGES.SwitchToTraditionalChinese();
  } else if (localeName == "es_ES") {
    nativeName = MESSAGES.SwitchToSpanish();
  } else if (localeName == "fr_FR") {
    nativeName = MESSAGES.SwitchToFrench();
  } else if (localeName == "it_IT") {
    nativeName = MESSAGES.SwitchToItalian();
  } else if (localeName == "ru") {
    nativeName = MESSAGES.SwitchToRussian();
  } else if (localeName == "ko_KR") {
    nativeName = MESSAGES.SwitchToKorean();
  } else if (localeName == "sv") {
    nativeName = MESSAGES.SwitchToSwedish();
  } else if (localeName == "pt_BR") {
    nativeName = MESSAGES.switchToPortugueseBR();
  } else if (localeName == "nl") {
    nativeName = MESSAGES.switchToDutch();
  }
  return nativeName;
}
 
開發者ID:mit-cml,項目名稱:appinventor-extensions,代碼行數:26,代碼來源:TopPanel.java

示例2: BlocklyPanel

import com.google.gwt.i18n.client.LocaleInfo; //導入依賴的package包/類
public BlocklyPanel(YaBlocksEditor blocksEditor, String formName, boolean readOnly) {
  super("");
  getElement().addClassName("svg");
  getElement().setId(formName);
  this.formName = formName;
  /* Blockly initialization now occurs in three stages. This is due to the fact that certain
   * Blockly objects rely on SVG methods such as getScreenCTM(), which are not properly
   * initialized and/or null prior to the svg element being attached to the DOM. The first
   * stage of initialization happens here.
   *
   * Stages 2 and 3 can occur in different orders depending on network latency. On a fast
   * connection, the second stage will be loading of the .bky content into the workspace.
   * The third stage will then be rendering of the workspace when the user switches to the
   * Blocks editor. On slow connections, the workspace may render blank until the blocks file
   * has been downloaded from the server.
   */
  initWorkspace(Long.toString(blocksEditor.getProjectId()), readOnly, LocaleInfo.getCurrentLocale().isRTL());
  OdeLog.log("Created BlocklyPanel for " + formName);
}
 
開發者ID:mit-cml,項目名稱:appinventor-extensions,代碼行數:20,代碼來源:BlocklyPanel.java

示例3: forLocale

import com.google.gwt.i18n.client.LocaleInfo; //導入依賴的package包/類
public static GJLocaleSymbols forLocale(LocaleInfo locale) {
    if (locale == null) {
        locale = LocaleInfo.getCurrentLocale();
    }
    int index = System.identityHashCode(locale) & (FAST_CACHE_SIZE - 1);
    GJLocaleSymbols symbols = cFastCache[index];
    if (symbols != null && locale.equals(symbols.iLocale)) {
        return symbols;
    }
    synchronized (cCache) {
        symbols = cCache.get(locale);
        if (symbols == null) {
            symbols = new GJLocaleSymbols(locale);
            cCache.put(locale, symbols);
        }
    }
    cFastCache[index] = symbols;
    return symbols;
}
 
開發者ID:NOAA-PMEL,項目名稱:LAS,代碼行數:20,代碼來源:GJLocaleSymbols.java

示例4: getCurrentLocale

import com.google.gwt.i18n.client.LocaleInfo; //導入依賴的package包/類
@Override
public String getCurrentLocale() {
    String locale = LocaleInfo.getCurrentLocale().getLocaleName();
    if (locale == null) {
        Log.d("JsLocaleProvider", "Found Null. Returning En");
        return "En";
    }
    if ("default".equals(locale)) {
        Log.d("JsLocaleProvider", "Found default. Returning En");
        return "En";
    }
    if (locale.length() >= 2) {
        String res = locale.substring(0, 1).toUpperCase() + locale.substring(1, 2).toLowerCase();
        Log.d("JsLocaleProvider", "Found " + res);
        return res;
    }
    Log.d("JsLocaleProvider", "Found unknown: " + locale + ". Returning En.");
    return "En";
}
 
開發者ID:wex5,項目名稱:dangchat-sdk,代碼行數:20,代碼來源:JsLocaleProvider.java

示例5: doubleToString

import com.google.gwt.i18n.client.LocaleInfo; //導入依賴的package包/類
/**
   * Returns the given value with a decimal part reduced to a length of {@link #DECIMAL_PART_MAX_LENGTH}.
   * If client-side, also replace the decimal separator by the one specified in the current locale.
   * 
   * @param value
*			Value to convert.
   * @return the given double as a <code>String</code>.
   */
  private String doubleToString(double value) {
      final String base = Double.toString(value);
      final int index = base.indexOf('.');
      
      final String decimalSeparator;
      if (GWT.isClient()) {
          decimalSeparator = LocaleInfo.getCurrentLocale().getNumberConstants().decimalSeparator();
      } else {
          decimalSeparator = ".";
      }
      
      if (base.length() - index - 1 > DECIMAL_PART_MAX_LENGTH) {
          return base.substring(0, index) + decimalSeparator + base.substring(index + 1, index + 1 + DECIMAL_PART_MAX_LENGTH);
      } else {
          return base.replace(".", decimalSeparator);
      }
  }
 
開發者ID:sigmah-dev,項目名稱:sigmah,代碼行數:26,代碼來源:DoubleValue.java

示例6: initializeCalendarWidget

import com.google.gwt.i18n.client.LocaleInfo; //導入依賴的package包/類
/**
 * {@inheritDoc}
 */
@Override
public void initializeCalendarWidget(final CalendarWidget calendarWidget) {

	// Defining the first day of the week
	// BUGFIX #653: Contrary to the deprecated DateTimeConstants, firstDayOfTheWeek starts at 0 (and not 1). No substraction is needed.
	final DateTimeFormatInfo constants = LocaleInfo.getCurrentLocale().getDateTimeFormatInfo();
	calendarWidget.setFirstDayOfWeek(constants.firstDayOfTheWeek());

	// Retrieving the current calendar header
	calendarView.setHeadingHtml(calendarWidget.getHeading());

	// Listening for further calendar header changes
	calendarWidget.setListener(new CalendarWidget.CalendarListener() {

		@Override
		public void afterRefresh() {
			calendarView.setHeadingHtml(calendarWidget.getHeading());
		}
	});

	calendarView.add(calendarWidget, Layouts.fitData(Margin.DOUBLE_TOP, Margin.DOUBLE_RIGHT, Margin.DOUBLE_BOTTOM, Margin.DOUBLE_LEFT));
}
 
開發者ID:sigmah-dev,項目名稱:sigmah,代碼行數:26,代碼來源:CalendarView.java

示例7: goToLocation

import com.google.gwt.i18n.client.LocaleInfo; //導入依賴的package包/類
public void goToLocation(final String location) {
	GwtCommand command = new GwtCommand(GetLocationForStringRequest.COMMAND);
	GetLocationForStringRequest request = new GetLocationForStringRequest();
	request.setCrs(map.getMapModel().getCrs());
	request.setLocation(location);
	request.setServicePattern(servicePattern);
	if (GWT.isClient()) {
		// causes NPE when run as junit test
		String locale = LocaleInfo.getCurrentLocale().getLocaleName();
		if (!"default".equals(locale)) {
			request.setLocale(locale);
		}
	}
	command.setCommandRequest(request);
	GwtCommandDispatcher.getInstance().execute(command,
			new AbstractCommandCallback<GetLocationForStringResponse>() {

		public void execute(GetLocationForStringResponse response) {
			goToLocation(response, location);
		}
	});
}
 
開發者ID:geomajas,項目名稱:geomajas-project-client-gwt,代碼行數:23,代碼來源:GeocoderPresenter.java

示例8: LocaleSelect

import com.google.gwt.i18n.client.LocaleInfo; //導入依賴的package包/類
/**
 * Constructor.
 *
 * @param defaultLocaleLabel label for the default locale
 */
public LocaleSelect(String defaultLocaleLabel) {
	super();
	locales = Geomajas.getSupportedLocales();
	locales.put("default", defaultLocaleLabel);
	setHeight(28);
	setWidth(200);

	// Build a small form with a select item for locales:
	DynamicForm form = new DynamicForm();
	ComboBoxItem localeItem = new ComboBoxItem();
	localeItem.setValueMap(locales.values().toArray(new String[locales.size()]));
	localeItem.setTitle(I18nProvider.getGlobal().localeTitle());

	// Show the current locale value in the select item:
	String currentLocale = LocaleInfo.getCurrentLocale().getLocaleName();
	localeItem.setValue(locales.get(currentLocale));

	// Add the changed handler, and build the widget:
	localeItem.addChangedHandler(this);
	form.setFields(localeItem);
	addChild(form);
}
 
開發者ID:geomajas,項目名稱:geomajas-project-client-gwt,代碼行數:28,代碼來源:LocaleSelect.java

示例9: getViewPanel

import com.google.gwt.i18n.client.LocaleInfo; //導入依賴的package包/類
public Canvas getViewPanel() {
	VLayout layout = new VLayout();
	layout.setWidth100();
	layout.setHeight100();

	Img logo = new Img("[ISOMORPHIC]/geomajas/geomajas_logo.png");
	logo.setWidth(600);
	logo.setHeight(220);
	logo.setMargin(30);
	logo.setLayoutAlign(Alignment.CENTER);

	HTMLPane pane = new HTMLPane();
	String currentLocale = LocaleInfo.getCurrentLocale().getLocaleName();
	if ("default".equals(currentLocale)) {
		pane.setContentsURL("[ISOMORPHIC]/geomajas/example/pages/intro.html");
	} else if ("nl".equals(currentLocale)) {
		pane.setContentsURL("[ISOMORPHIC]/geomajas/example/pages/intro_nl.html");
	}

	layout.addMember(logo);
	layout.addMember(pane);

	return layout;
}
 
開發者ID:geomajas,項目名稱:geomajas-project-client-gwt,代碼行數:25,代碼來源:IntroductionTab.java

示例10: GwtCommandDispatcher

import com.google.gwt.i18n.client.LocaleInfo; //導入依賴的package包/類
private GwtCommandDispatcher() {
	locale = LocaleInfo.getCurrentLocale().getLocaleName();
	if ("default".equals(locale)) {
		locale = null;
	}
	deferreds = new ArrayList<Deferred>();
	service = (GeomajasServiceAsync) GWT.create(GeomajasService.class);
	setServiceEndPointUrl(GWT.getModuleBaseURL() + "geomajasService");
	setUseLazyLoading(true);
	setShowError(true);

	Window.addWindowClosingHandler(new ClosingHandler() {

		public void onWindowClosing(ClosingEvent event) {
			GwtCommandDispatcher.getInstance().setShowError(false);

			// Cancel all outstanding requests:
			for (Deferred deferred : deferreds) {
				deferred.cancel();
			}
		}
	});
}
 
開發者ID:geomajas,項目名稱:geomajas-project-client-gwt2,代碼行數:24,代碼來源:GwtCommandDispatcher.java

示例11: configurationSetting

import com.google.gwt.i18n.client.LocaleInfo; //導入依賴的package包/類
@Override
public void configurationSetting(final boolean isInit) {
    String languageName = languageItem.getSelectedItem().getK2();
    String isRefresh = Window.Location.getParameter("isRefresh");
    if ((isRefresh == null || isRefresh.equals("")) && isInit) {
        Window.Location.assign(Window.Location.createUrlBuilder()
                                       .removeParameter(LocaleInfo.getLocaleQueryParam())
                                       .setParameter(LocaleInfo.getCurrentLocale().getLocaleQueryParam(),
                                                     languageName)
                                       .setParameter("isRefresh",
                                                     "false")
                                       .buildString());
    } else if (!isInit) {
        Window.Location.assign(Window.Location.createUrlBuilder()
                                       .removeParameter(LocaleInfo.getLocaleQueryParam())
                                       .setParameter(LocaleInfo.getCurrentLocale().getLocaleQueryParam(),
                                                     languageName)
                                       .buildString());
    }
}
 
開發者ID:kiegroup,項目名稱:kie-wb-common,代碼行數:21,代碼來源:LanguageConfigurationHandler.java

示例12: onBrowserEvent2

import com.google.gwt.i18n.client.LocaleInfo; //導入依賴的package包/類
@Override
protected void onBrowserEvent2(Event event) {
  super.onBrowserEvent2(event);

  // Handle keyboard navigation between lists.
  String eventType = event.getType();
  if (BrowserEvents.KEYDOWN.equals(eventType) && !isKeyboardNavigationSuppressed()) {
    int keyCode = event.getKeyCode();
    boolean isRtl = LocaleInfo.getCurrentLocale().isRTL();
    keyCode = KeyCodes.maybeSwapArrowKeysForRtl(keyCode, isRtl);
    switch (keyCode) {
      case KeyCodes.KEY_LEFT:
        keyboardNavigateShallow();
        return;
      case KeyCodes.KEY_RIGHT:
        keyboardNavigateDeep();
        return;
    }
  }
}
 
開發者ID:consulo,項目名稱:consulo,代碼行數:21,代碼來源:CellBrowser.java

示例13: scrollToEnd

import com.google.gwt.i18n.client.LocaleInfo; //導入依賴的package包/類
void scrollToEnd() {
  Element elem = getElement();
  targetScrollLeft = elem.getScrollWidth() - elem.getClientWidth();
  if (LocaleInfo.getCurrentLocale().isRTL()) {
    targetScrollLeft *= -1;
  }

  if (isAnimationEnabled()) {
    // Animate the scrolling.
    startScrollLeft = elem.getScrollLeft();
    run(250, elem);
  } else {
    // Scroll instantly.
    onComplete();
  }
}
 
開發者ID:consulo,項目名稱:consulo,代碼行數:17,代碼來源:CellBrowser.java

示例14: getImageHtml

import com.google.gwt.i18n.client.LocaleInfo; //導入依賴的package包/類
/**
 * Get the HTML representation of an image.
 *
 * @param res the {@link ImageResource} to render as HTML
 * @return the rendered HTML
 */
private SafeHtml getImageHtml(ImageResource res) {
  // Right-justify image if LTR, left-justify if RTL
  AbstractImagePrototype proto = AbstractImagePrototype.create(res);
  SafeHtml image = proto.getSafeHtml();

  SafeStylesBuilder cssBuilder = new SafeStylesBuilder();
  if (LocaleInfo.getCurrentLocale().isRTL()) {
    cssBuilder.appendTrustedString("left:0px;");
  } else {
    cssBuilder.appendTrustedString("right:0px;");
  }
  cssBuilder.appendTrustedString("width: " + res.getWidth() + "px;");
  cssBuilder.appendTrustedString("height: " + res.getHeight() + "px;");
  return template.imageWrapper(cssBuilder.toSafeStyles(), image);
}
 
開發者ID:consulo,項目名稱:consulo,代碼行數:22,代碼來源:CellBrowser.java

示例15: getCssExpression

import com.google.gwt.i18n.client.LocaleInfo; //導入依賴的package包/類
@Override
protected String getCssExpression(TreeLogger logger, ResourceContext context,
    JMethod method) throws UnableToCompleteException {
  CssTree cssTree = cssTreeMap.get(method).tree;

  String standard = printCssTree(cssTree);

  // TODO add configuration properties for swapLtrRtlInUrl, swapLeftRightInUrl and
  // shouldFlipConstantReferences booleans
  RecordingBidiFlipper recordingBidiFlipper =
      new RecordingBidiFlipper(cssTree.getMutatingVisitController(), false, false, true);
  recordingBidiFlipper.runPass();

  if (recordingBidiFlipper.nodeFlipped()) {
    String reversed = printCssTree(cssTree);
    return LocaleInfo.class.getName() + ".getCurrentLocale().isRTL() ? "
        + reversed + " : " + standard;
  } else {
    return standard;
  }
}
 
開發者ID:jDramaix,項目名稱:gss.gwt,代碼行數:22,代碼來源:GssResourceGenerator.java


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