-
- text_target = formFactory.createLanguageStringWithLabelElement(element, null, null, TEXT_HEIGHT, SWT.NULL);
-
- Button button_translationService = formFactory.createButton(element.getLayoutComposite(), "Translate", SWT.PUSH);
- button_translationService.addSelectionListener(new SelectionAdapter() {
- /* (non-Javadoc)
- * @see org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent)
- */
- @Override
- public void widgetSelected(SelectionEvent event) {
- ITranslationServiceWrapper service = new GoogleLanguageApiWrapper();
- String translatedText;
- try {
- String text = text_source.getText();
- Language sourceLanguage = text_source.getLanguageString().getLanguage();
- Language targetLanguage = combo_targetLanguage.getSelection();
-
- translatedText = service.translate(text, sourceLanguage, targetLanguage);
- text_target.setText(translatedText);
- } catch (LanguageNotSupportedException e) {
- StoreUtil.warningDialog("Language not supported", TranslationWizardPage.class, e.getMessage());
- } catch (Exception e){
- StoreUtil.warningDialog("Error translating text", TranslationWizardPage.class, e.getMessage());
- }
-
- }
- });
+
+ text_target = formFactory.createLanguageStringWithLabelElement(element, null, null, TEXT_HEIGHT, true, SWT.NULL);
+
+ //
+ // The automated translation did rely on the Google Translate API. Unfortunately this service is not free anymore.
+ // See http://code.google.com/apis/language/translate/overview.html
+ //
+// Button button_translationService = formFactory.createButton(element.getLayoutComposite(), "Translate", SWT.PUSH);
+// button_translationService.addSelectionListener(new SelectionAdapter() {
+// /* (non-Javadoc)
+// * @see org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent)
+// */
+// @Override
+// public void widgetSelected(SelectionEvent event) {
+// ITranslationServiceWrapper service = new GoogleLanguageApiWrapper();
+// String translatedText;
+// try {
+// String text = text_source.getText();
+// Language sourceLanguage = text_source.getLanguageString().getLanguage();
+// Language targetLanguage = combo_targetLanguage.getSelection();
+//
+// if(targetLanguage == null){
+// StoreUtil.warningDialog("Please select a target language", TranslationWizardPage.class, "Please select a language from the combo box at the right.");
+// return;
+// }
+//
+// translatedText = service.translate(text, sourceLanguage, targetLanguage);
+// text_target.setText(translatedText);
+// } catch (LanguageNotSupportedException e) {
+// StoreUtil.warningDialog("Language not supported", TranslationWizardPage.class, "The chosen language is not supported by the translation service.");
+// } catch (Exception e){
+// StoreUtil.warningDialog("Error translating text", TranslationWizardPage.class, e.getMessage());
+// }
+//
+// }
+// });