Class LiteralsService

java.lang.Object
com.almis.awe.config.ServiceConfig
com.almis.awe.developer.service.LiteralsService
All Implemented Interfaces:
org.springframework.beans.factory.Aware, org.springframework.context.ApplicationContextAware

public class LiteralsService extends ServiceConfig
  • Constructor Details

    • LiteralsService

      public LiteralsService(TranslationService translationService, LocaleFileService localeFileService, BaseConfigProperties baseConfigProperties)
      Autowired constructor
      Parameters:
      translationService - Translation service
      localeFileService - Locale service
      baseConfigProperties - Base properties
  • Method Details

    • translate

      public ServiceData translate(String text, String fromLanguage, String toLanguage) throws AWException
      Translate from one language to other
      Parameters:
      text - Text to translate
      fromLanguage - Source language
      toLanguage - Target language
      Returns:
      Translation
      Throws:
      AWException - Error translating text
    • getLocaleMatches

      public ServiceData getLocaleMatches(String literal, String codeLang) throws AWException
      Returns the locale match list for a string given the language
      Parameters:
      literal - Code
      codeLang - Language
      Returns:
      Service
      Throws:
      AWException - Error retrieving locale matches
    • getTranslationList

      public ServiceData getTranslationList(String code) throws AWException
      Returns existing translations corresponding to a code
      Parameters:
      code - Code
      Returns:
      Translation list
      Throws:
      AWException - Error retrieving translation list
    • saveTranslation

      public ServiceData saveTranslation(String formatSelector, String text, String markdown, String codeLang, String searchLang, String code) throws AWException
      Save translation
      Parameters:
      formatSelector - Format selector
      text - Text
      markdown - Markdown
      codeLang - Language
      searchLang - Language (search)
      code - Code
      Returns:
      Translation stored
      Throws:
      AWException - Error storing translation
    • newLiteral

      public ServiceData newLiteral(String codeLang, String code, String literal) throws AWException
      Save new literal
      Parameters:
      codeLang - Language
      code - Code
      literal - Text
      Returns:
      New literal created
      Throws:
      AWException - Error creating new locale
    • deleteLiteral

      public ServiceData deleteLiteral(String code) throws AWException
      Delete literal
      Parameters:
      code - Code
      Returns:
      Deletion message
      Throws:
      AWException - Error deleting locale
    • getUsingLanguage

      public ServiceData getUsingLanguage()
      Returns using language
      Returns:
      Used language
    • getSelectedLocale

      public ServiceData getSelectedLocale(String codeLang, String code) throws AWException
      Get Markdown text of literal from file
      Parameters:
      codeLang - Language
      code - code
      Returns:
      Markdown text
      Throws:
      AWException - Error retrieving markdown
    • switchLanguages

      public ServiceData switchLanguages(String fromLanguage, String toLanguage, String fromTarget, String toTarget)
      Switch the languages
      Parameters:
      fromLanguage - Source language
      toLanguage - Target language
      fromTarget - Source target
      toTarget - Target
      Returns:
      Languages changed