gpt4 book ai didi

pl.edu.icm.model.bwmeta.y.YLanguage.getShortCode()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-16 06:58:40 28 4
gpt4 key购买 nike

本文整理了Java中pl.edu.icm.model.bwmeta.y.YLanguage.getShortCode()方法的一些代码示例,展示了YLanguage.getShortCode()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。YLanguage.getShortCode()方法的具体详情如下:
包路径:pl.edu.icm.model.bwmeta.y.YLanguage
类名称:YLanguage
方法名:getShortCode

YLanguage.getShortCode介绍

暂无

代码示例

代码示例来源:origin: pl.edu.icm.synat/synat-portal-core

protected void fillLanguages(HtmlMetaHeaders metadata, YElement yElement) {
  for (YLanguage yLanguage : yElement.getLanguages()) {
    if (StringUtils.isNotEmpty(yLanguage.getShortCode())) {
      metadata.addMetadataName(DC_NAMESPACE + SEPARATOR + DublinCoreStrings.E_LANGUAGE, yLanguage.getShortCode());
    }
  }
}

代码示例来源:origin: pl.edu.icm.yadda/yaddaweb-lite-core

protected String prepareLanguages(YElement element) {
  StringBuilder langs = new StringBuilder();
  boolean wasFirst = false;
  for (YLanguage lang : element.getLanguages()) {
    if (wasFirst) {
      langs.append(",");
      langs.append(" ");
    }
    langs.append(languageDictionary.getShortDescription(lang.getShortCode()));
    wasFirst = true;
  }
  return langs.toString().trim();
}

代码示例来源:origin: pl.edu.icm.yadda/yaddaweb-lite-core

protected List<LocalizedString> prepareLanguagesSeparated(YElement element) {
  List<LocalizedString> langs = new ArrayList<LocalizedString>();
  for (YLanguage lang : element.getLanguages()) {
    langs.add(new LocalizedString( languageDictionary.getShortDescription(lang.getShortCode()), languageDictionary.getShortDescription(lang.getShortCode())));
  }
  return langs;
}

代码示例来源:origin: pl.edu.icm.yadda.repowebeditor/repository-web-editor-core

public String extractLanguageCode(YLanguage yLanguage){
  
  String code = yLanguage.getShortCode();
  if(code.isEmpty())
    code = yLanguage.getTerminologyCode();
  if(code.isEmpty())
    code = yLanguage.getBibliographicCode();
  if(code.isEmpty())
    code = yLanguage.getName();
  
  return code;
}

代码示例来源:origin: pl.edu.icm.synat/synat-process-common

public static synchronized void loadData() {
  if (loaded) {
    return;
  }
  loaded = true;
  List<String> profileData = new ArrayList<String>();
  try {
    Charset encoding = Charset.forName("UTF-8");
    for (YLanguage language : detectableLanguages) {
      try (InputStream stream = new ClassPathResource("langdetect-profiles/" + language.getShortCode()).getInputStream();
          BufferedReader reader = new BufferedReader(new InputStreamReader(stream, encoding));) {
        profileData.add(new String(IOUtils.toCharArray(reader)));
      }
    }
    DetectorFactory.loadProfile(profileData);
    DetectorFactory.setSeed(System.currentTimeMillis());
  } catch (IOException | LangDetectException e) {
    throw new GeneralBusinessException(e);
  }
}

代码示例来源:origin: pl.edu.icm.synat/synat-business-services-api

public static Locale getUserLocale(final UserProfile profile) {
  if (profile.getLanguage() == null) {
    return Locale.ENGLISH; // TODO What should be the default locale if UserProfile has no language? Does situation when user don't have language is possible?
  }
  return new Locale(profile.getLanguage().getyLanguage().getShortCode());
}

代码示例来源:origin: pl.edu.icm.yadda.repowebeditor/repository-web-editor-core

public YLanguage byCodeName(String code, YLanguage fallback) {
  if (code == null || code.isEmpty())
    return fallback;
  code = code.toLowerCase(Locale.ENGLISH);
  for (YLanguage lang : YLanguage.values()) {
    if (code.equals(lang.getShortCode()))
      return lang;
    if (code.equals(lang.getBibliographicCode()))
      return lang;
    if (code.equals(lang.getTerminologyCode()))
      return lang;
    if (isInArrayIgnoreCase(lang.getNames(), code))
      return lang;
  }
  return fallback;
}

代码示例来源:origin: pl.edu.icm.synat/synat-portal-core

private LanguageData makeLanguageData(final YLanguage yLanguage, final Locale locale) {
  final String longDesc = languageDictionary.getLongDescription(yLanguage.getBibliographicCode(), locale);
  return new LanguageData(yLanguage, yLanguage.getShortCode(), longDesc);
}

代码示例来源:origin: pl.edu.icm.bwmeta/bwmeta-2-foreign-transformers

private YLanguage extractYLanguage(Attribute langAttribute) {
  if (langAttribute == null) {
    return null;
  }
  String langStr = langAttribute.getValue();
  if (langStr == null) {
    return null;
  }
  langStr = langStr.trim();
  for (YLanguage lang : YLanguage.values()) {
    if (lang.getBibliographicCode().equals(langStr) || lang.getShortCode().equals(langStr)
        || lang.getTerminologyCode().equals(langStr)) {
      return lang;
    }
    for (String langName : lang.getNames()) {
      if (langName != null && langName.equals(langStr)) {
        return lang;
      }
    }
  }
  return null;
}

代码示例来源:origin: pl.edu.icm.synat/synat-portal-core

private KeywordsData makeLocalizedKeywordsData(final YTagList yTagList, final YLanguage yLanguage, Locale locale) {
  if (yTagList.getType().equals(TG_KEYWORD)) {
    List<String> tags = new ArrayList<String>();
    for (YRichText richTag : yTagList.getRichValues()) {
      tags.add(richTag.toText().replaceAll(YModelUtils.LF_CR, YModelUtils.CR));
    }
    String longDesc = languageDictionary.getLongDescription(yLanguage.getBibliographicCode(), locale);
    LanguageData data = new LanguageData(yLanguage, yLanguage.getShortCode(), longDesc);
    return new KeywordsData(data).setStringData(tags);
  }
  return null;
}

代码示例来源:origin: pl.edu.icm.synat/synat-portal-core

@Override
public Locale resolveLocale(HttpServletRequest request) {
  try {
    UserProfile userProfile = userBusinessService.getCurrentUserProfile();
    if (userProfile != null && userProfile.getLanguage() != null) {
      return StringUtils.parseLocaleString(userProfile.getLanguage().getyLanguage().getShortCode());
    }
  } catch (Exception e) {
    logger.warn(e.getMessage(), e);
  }
  return super.resolveLocale(request);
}

代码示例来源:origin: pl.edu.icm.yadda.repowebeditor/repository-web-editor-core

public LanguageInfo asLanguageInfo(YLanguage yLanguage, Locale inLocale) {
  String shortCode = yLanguage.getShortCode();
  String code = languageExtractor.extractLanguageCode(yLanguage);
  Locale langLocale = new Locale(code);
  String name = langLocale.getDisplayLanguage(inLocale);
  return new LanguageInfo.Builder()
      .code(code)
      .shortCode(shortCode)
      .name(name)
      .build();
}

代码示例来源:origin: pl.edu.icm.yadda/yaddaweb-lite-core

private Map<String, List<LocalizedString>> prepareTypedNames(YElement element,
    IFilteringContext filteringContext) {
  Map<String, List<LocalizedString>> result = new HashMap<String, List<LocalizedString>>();
  for (YName name : element.getNames()) {
      String lang = languageDictionary.getShortDescription(name.getLanguage().getShortCode());
      String text = detailsFilter.filter(YRTHelper.toXmlFragment(name.getRichText()),
          InputType.RICH_TEXT, filteringContext);
      LocalizedString ls = new LocalizedString(lang, text);
      
      List<LocalizedString> list;
      String type = name.getType();
      if (!result.containsKey(type)) {
        list = new ArrayList<LocalizedString>();
        result.put(type, list);
      } else {
        list = result.get(type);
      }
      list.add(ls);
  }
  return result;
}

代码示例来源:origin: pl.edu.icm.synat/synat-console-core

@Override
public List<GroupTimePeriod> getTimePeriods(Organisation organisation) {
  List<GroupTimePeriod> timePeriods = new ArrayList<GroupTimePeriod>();
  int i = 0;
  Page<GroupTimePeriod> page = null;
  do {
    GroupTimePeriodQuery query = new GroupTimePeriodQuery();
    query.setPageNo(i++);
    query.setPageSize(Integer.parseInt(DEFAULT_PAGE_SIZE));
    query.setOrganisationId(organisation.getId());
    page = licensingService.fetchOrganisationGroupAssignments(query);
    timePeriods.addAll(page.getResult());
  } while (page.getTotalPages() > i);
  final Locale polish = Locale.forLanguageTag(YLanguage.Polish.getShortCode());
  final Collator polishCollator = Collator.getInstance(polish);
  Collections.sort(timePeriods, new Comparator<GroupTimePeriod>() {
    @Override
    public int compare(final GroupTimePeriod object1, final GroupTimePeriod object2) {
      return polishCollator.compare(object1.getOrganisationGroup().getName(), object2.getOrganisationGroup().getName());
    }
  });
  return timePeriods;
}

代码示例来源:origin: pl.edu.icm.yadda/yaddaweb-lite-core

protected List<LocalizedString> getDescription(YInstitution element,
    IFilteringContext filteringContext, String type) {
  List<LocalizedString> result = new ArrayList<LocalizedString>();
  
  for (YDescription description : element.getDescriptions()) {
    if (type.equals(description.getType())) {
      result.add(new LocalizedString(languageDictionary.getShortDescription(
        description.getLanguage().getShortCode()),
        detailsFilter.filter(YRTHelper.toXmlFragment(description.getRichText()), InputType.RICH_TEXT,
        filteringContext)));
    }
  }
  
  return result;
}

代码示例来源:origin: pl.edu.icm.yadda/yaddaweb-lite-core

protected List<LocalizedString> getDescription(YElement element,
      IFilteringContext filteringContext, String type) {
  List<LocalizedString> result = new ArrayList<LocalizedString>();
  
  for (YDescription description : element.getDescriptions()) {
    if (type.equals(description.getType())) {
      result.add(new LocalizedString(languageDictionary.getShortDescription(
        description.getLanguage().getShortCode()),
        detailsFilter.filter(YRTHelper.toXmlFragment(description.getRichText()), InputType.RICH_TEXT,
        filteringContext)));
    }
  }
  
  return result;
}

代码示例来源:origin: pl.edu.icm.yadda/yadda-polindex

private LanguageEnum convertLanguage(YElement yElement) {
  LanguageEnum result = DEFAULT_LANGUAGE;
  
  YLanguage ylanguage = yElement.getOneLanguage();
  
  if (YLanguage.Undetermined != ylanguage) {
    try {
      result = LanguageEnum.fromValue( ylanguage.getShortCode() );
    } catch (IllegalArgumentException e) {
      logArticleWarning(yElement.getId(), "language {} can not be converted to polindex language, default language ({}) is set", ylanguage, DEFAULT_LANGUAGE);
    }
  }
  
  return result;
}

代码示例来源:origin: pl.edu.icm.yadda/yaddaweb-lite-core

private Object prepareTitles(List<YName> names, YName defaultName, IFilteringContext filteringContext) {
  List<LocalizedString> res = new ArrayList<LocalizedString>();
  if (names != null)
    for (YName name : names) {
      if (defaultName != name && YNameAndYDescriptionSorter.isMainOrAlternativeName(name.getType())) {
        String lang = languageDictionary.getShortDescription(name.getLanguage().getShortCode());
        res.add(new LocalizedString(lang, detailsFilter.filter(YRTHelper.toXmlFragment(name.getRichText()),
            InputType.RICH_TEXT, filteringContext)));
      }
    }
  return res;
}

代码示例来源:origin: pl.edu.icm.yadda/yaddaweb-lite-core

protected List<LocalizedString> prepareTitles(YElement element, IFilteringContext filteringContext) {
  YName oneName = element.getDefaultName();
  List<LocalizedString> res = new ArrayList<LocalizedString>();
  for (YName name : element.getNames()) {
    if (name != oneName && YNameAndYDescriptionSorter.isMainOrAlternativeName(name.getType())) {
      String lang = languageDictionary.getShortDescription(name.getLanguage().getShortCode());
      res.add(new LocalizedString(lang, detailsFilter.filter(
          YRTHelper.toXmlFragment(name.getRichText()),
          InputType.RICH_TEXT, filteringContext)));
    }
  }
  return res;
}

代码示例来源:origin: pl.edu.icm.synat/synat-portal-core

/**
 * Handler for user settings edit page BASIC IMPLEMENTATION
 *
 * @return view name
 */
@RequestMapping(value = USER_SETTINGS_EDIT, method = RequestMethod.GET)
public ModelAndView settingsEditHandler(HttpServletRequest request) {
  ModelAndView results = new ModelAndView(USER_SETTINGS_EDIT);
  UserSettingsForm userSettingsForm = new UserSettingsForm();
  UserProfile loggedUserProfile = userBusinessService.getCurrentUserProfile();
  if (loggedUserProfile != null) {
    userSettingsForm.setHighContrastFacilitation(loggedUserProfile.isHighContrastFacilitation());
    userSettingsForm.setLanguage(loggedUserProfile.getLanguage()!=null?loggedUserProfile.getLanguage().getyLanguage().getShortCode():"pl");
    userSettingsForm.setNotificationsSendInterval(loggedUserProfile.getNotificationsSendInterval());
  } else {
    Locale locale = localeResolver.resolveLocale(request);
    String themeName = themeResolver.resolveThemeName(request);
    userSettingsForm.setLanguage(locale.getLanguage());
    userSettingsForm.setHighContrastFacilitation(themeName.equals(PortalThemeResolver.PORTAL_HIGH_CONTRAST_THEME));
  }
  results.addObject("userSettingsForm", userSettingsForm);
  return results;
}

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com