Package com.almis.awe.developer.service
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
-
Constructor Summary
ConstructorDescriptionLiteralsService
(TranslationService translationService, LocaleFileService localeFileService, BaseConfigProperties baseConfigProperties) Autowired constructor -
Method Summary
Modifier and TypeMethodDescriptiondeleteLiteral
(String code) Delete literalgetLocaleMatches
(String literal, String codeLang) Returns the locale match list for a string given the languagegetSelectedLocale
(String codeLang, String code) Get Markdown text of literal from filegetTranslationList
(String code) Returns existing translations corresponding to a codeReturns using languagenewLiteral
(String codeLang, String code, String literal) Save new literalsaveTranslation
(String formatSelector, String text, String markdown, String codeLang, String searchLang, String code) Save translationswitchLanguages
(String fromLanguage, String toLanguage, String fromTarget, String toTarget) Switch the languagesTranslate from one language to otherMethods inherited from class com.almis.awe.config.ServiceConfig
containsBean, getApplicationContext, getBean, getBean, getElements, getLocale, getLocale, getProperty, getProperty, getRequest, getSession, setApplicationContext
-
Constructor Details
-
LiteralsService
public LiteralsService(TranslationService translationService, LocaleFileService localeFileService, BaseConfigProperties baseConfigProperties) Autowired constructor- Parameters:
translationService
- Translation servicelocaleFileService
- Locale servicebaseConfigProperties
- 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 translatefromLanguage
- Source languagetoLanguage
- Target language- Returns:
- Translation
- Throws:
AWException
- Error translating text
-
getLocaleMatches
Returns the locale match list for a string given the language- Parameters:
literal
- CodecodeLang
- Language- Returns:
- Service
- Throws:
AWException
- Error retrieving locale matches
-
getTranslationList
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 selectortext
- Textmarkdown
- MarkdowncodeLang
- LanguagesearchLang
- Language (search)code
- Code- Returns:
- Translation stored
- Throws:
AWException
- Error storing translation
-
newLiteral
Save new literal- Parameters:
codeLang
- Languagecode
- Codeliteral
- Text- Returns:
- New literal created
- Throws:
AWException
- Error creating new locale
-
deleteLiteral
Delete literal- Parameters:
code
- Code- Returns:
- Deletion message
- Throws:
AWException
- Error deleting locale
-
getUsingLanguage
Returns using language- Returns:
- Used language
-
getSelectedLocale
Get Markdown text of literal from file- Parameters:
codeLang
- Languagecode
- 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 languagetoLanguage
- Target languagefromTarget
- Source targettoTarget
- Target- Returns:
- Languages changed
-