类 CrowdinOTA

java.lang.Object
com.ghostchu.crowdin.CrowdinOTA

public class CrowdinOTA extends Object
  • 字段详细资料

    • distributionUrl

      protected final String distributionUrl
    • unirest

      protected final kong.unirest.UnirestInstance unirest
    • cacheFolder

      protected final File cacheFolder
    • manifest

      protected com.google.gson.JsonObject manifest
    • languageMapping

      protected Map<String,Map<String,String>> languageMapping
      The language mapping CrowdinSyntaxName, Map(Syntax, CustomName)
  • 构造器详细资料

    • CrowdinOTA

      public CrowdinOTA(@NotNull @NotNull String distributionUrl, @NotNull @NotNull File cacheFolder) throws OTAException
      Create CrowdinOTA instance from a crowdin distribution URL.
      参数:
      distributionUrl - The distribution URL. Example: ...
      cacheFolder - The folder to put cache files
      抛出:
      OTAException - Throws a OTAException while failed during requesting or processing the manifest.
    • CrowdinOTA

      public CrowdinOTA(@NotNull @NotNull String distributionUrl, @NotNull @NotNull File cacheFolder, @NotNull @NotNull kong.unirest.UnirestInstance unirest) throws OTAException
      Create CrowdinOTA instance from a crowdin distribution URL.
      参数:
      distributionUrl - The distribution URL. Example: ...
      cacheFolder - The folder to put cache files
      unirest - The unirest instance for requesting
      抛出:
      OTAException - Throws a OTAException while failed during requesting or processing manifest.
  • 方法详细资料

    • getOtaInstance

      @NotNull public @NotNull OTAInstance getOtaInstance()
      Gets the OTAInstance which you can locate to load or processing any file instance you want.
      返回:
      The OTAInstance instance.
    • getTimestamp

      public long getTimestamp()
      Gets the timestamp of this manifest
      返回:
      The timestamp of this manifest.
    • mapLanguageCode

      @NotNull public @NotNull String mapLanguageCode(@NotNull @NotNull String crowdinSyntaxCode, @NotNull @NotNull String customSyntax)
      Gets the mapped language code for the given locale. For example: "tr": { "locale": "tr-TR" } In this case, give "tr" for crowdinSyntaxCode and "locale" for customSyntaxName, "tr-TR" will be returns. If nothing matches, return crowdinSyntaxCode as-is.
      参数:
      crowdinSyntaxCode - The language code (crowdin name)
      customSyntax - The mapping name (custom name)
      返回:
      The mapped language code
    • mapLanguageCustom

      @NotNull public @NotNull String mapLanguageCustom(@NotNull @NotNull String customCode, @NotNull @NotNull String customSyntax)
      Gets the mapped language code for the given locale. For example: "tr": { "locale": "tr-TR" } In this case, give "tr-TR" for customCode and "locale" for customSyntaxName, "tr" will be returns. If nothing matches, return customCode as-is. It is the mapLanguage's reserve
      参数:
      customCode - The language code (custom name)
      customSyntax - The custom syntax name
      返回:
      The mapped language code