LangTranslitrate
Field that allows language converter option via input in one field and output in another field usin
Field that allows language converter option via input in one field and output in another field the space key will trigger conversion.
This component usage google translitrate API's for conversion
Features: 1. Both source and destination fields can be configured (text field or text area) 2. Both source and destination languages can be configured 3. Both source and destination field properties (i.e. width , height, values , css ) can be configured 4. Field display alignment can be configured (i.e. VERTICAL or HORIZONTAL) 5. Translation can be link or unlink via link-unlink button this is usefull for source and destination separate working 6. Source and destination values can be set or get via below methods source : get > getSourceValue() source : set > setSourceValue()
destination : get > getDestinationValue()
destination : set > setDestinationValue()
Usage example:
LangTranslitrate lt = new LangTranslitrate() ;// LangTranslitrate(char fieldAlignment, char fieldType, int srcWidth, int srcHeight, int dstWidth, int dstHeight, String srcCaption, String dstCaption, LanguageCode srcLangCode, LanguageCode dstLangCode)
lt.setType(LangTranslitrate.TYPE_TEXTAREA); //TYPE_TEXTFIELD
lt.setAlignment(LangTranslitrate.VERTICAL_ALIGNMENT); // HORIZONTAL_ALIGNMENT
lt.setSourceLangCode(LanguageCode.ENGLISH); // LanguageCode.RUSSIAN
lt.setDestinationLangCode(LanguageCode.HINDI); //LanguageCode.ENGLISH
lt.setSourceCaption("Enter Source Text");
lt.setDestinationCaption("Translated Text");
//getting input and translated text
System.out.println("Source/ Input value is : " + lt.getSourceValue());
System.out.println("Destination/ Translated value is : " + lt.getDestinationValue());
Sample code
Usage example: LangTranslitrate lt = new LangTranslitrate() ; // LangTranslitrate(char fieldAlignment, char fieldType, int srcWidth, int srcHeight, int dstWidth, int dstHeight, String srcCaption, String dstCaption, LanguageCode srcLangCode, LanguageCode dstLangCode) lt.setType(LangTranslitrate.TYPE_TEXTAREA); //TYPE_TEXTFIELD lt.setAlignment(LangTranslitrate.VERTICAL_ALIGNMENT); // HORIZONTAL_ALIGNMENT lt.setSourceLangCode(LanguageCode.ENGLISH); // LanguageCode.RUSSIAN lt.setDestinationLangCode(LanguageCode.HINDI); //LanguageCode.ENGLISH lt.setSourceCaption("Enter Source Text"); lt.setDestinationCaption("Translated Text"); //getting input and translated text System.out.println("Source/ Input value is : " + lt.getSourceValue()); System.out.println("Destination/ Translated value is : " + lt.getDestinationValue());
Links
Compatibility
Was this helpful? Need more help?
Leave a comment or a question below. You can also join
the chat on Discord or
ask questions on StackOverflow.
Version
- Released
- 2012-02-22
- Maturity
- EXPERIMENTAL
- License
- Apache License 2.0
Compatibility
- Framework
- Vaadin 6.0+
- Browser
- Browser Independent