-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Translation providers improvements #98
Translation providers improvements #98
Conversation
…ntains other language, add translate all, translate only empty. Also experiment support in suggestion (disabled for now - list of xpath is not supported, only one xpath at a time).
@@ -32,225 +32,176 @@ | |||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |||
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" | |||
xmlns:xs="http://www.w3.org/2001/XMLSchema" | |||
xmlns:gn-fn-metadata="http://geonetwork-opensource.org/xsl/functions/metadata" | |||
xmlns:geonet="http://www.fao.org/geonetwork" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it required a template to remove geonet
elements also, other xslt in the process
folder has that type of template?
in the same xslt for iso19139 this line doesn't exist.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For harvesting no. I only tested suggestion with 115-3 for now but turned it off as it requires a bit more effort. Maybe we can check later when we add translation service in the editor and also align 19139 ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
geonet
namespace is required for suggestion templates
* Create a script ```js var mock = { parameter:{ q:'hello', source:'en', target:'fr' } }; function doGet(e) { e = e || mock; var sourceText = '' if (e.parameter.q){ sourceText = e.parameter.q; } var sourceLang = ''; if (e.parameter.source){ sourceLang = e.parameter.source; } var targetLang = 'en'; if (e.parameter.target){ targetLang = e.parameter.target; } var translatedText = LanguageApp.translate(sourceText, sourceLang, targetLang, {contentType: 'html'}); return ContentService.createTextOutput(translatedText).setMimeType(ContentService.MimeType.JSON); } ``` * Deploy it as webapp for anonymous user * Configure the service URL in the translation provider
…iguration. Add examples for easier XPath configuration.
...viders/src/main/java/org/fao/geonet/translations/googletranslate/GoogleTranslateService.java
Outdated
Show resolved
Hide resolved
.../src/main/java/org/fao/geonet/translations/libretranslate/LibreTranslateClientException.java
Outdated
Show resolved
Hide resolved
web-ui/src/main/resources/catalog/components/admin/harvester/HarvesterDirective.js
Show resolved
Hide resolved
web-ui/src/main/resources/catalog/components/admin/harvester/partials/translate.html
Outdated
Show resolved
Hide resolved
web-ui/src/main/resources/catalog/components/admin/harvester/partials/translate.html
Outdated
Show resolved
Hide resolved
…/googletranslate/GoogleTranslateService.java
…/libretranslate/LibreTranslateClientException.java
…artials/translate.html
…artials/translate.html
* Support for translation providers in harvesters * Support for translation providers / fix artifact in services/pom.xml * Support for translation providers / directive to select multiple languages * Support for translation providers / update harvester translation and use ACE Editor widget for translation fields configuration * Support for translation providers / refactor directive to select multiple languages to be generic * Support for translation providers / directive to select multiple languages - use a watcher to initialize typeahead when the data is available * Translation providers improvements (#98) * Support for translation providers / Better handle record which may contains other language, add translate all, translate only empty. Also experiment support in suggestion (disabled for now - list of xpath is not supported, only one xpath at a time). * Support for translation providers / Add google translate service * Create a script ```js var mock = { parameter:{ q:'hello', source:'en', target:'fr' } }; function doGet(e) { e = e || mock; var sourceText = '' if (e.parameter.q){ sourceText = e.parameter.q; } var sourceLang = ''; if (e.parameter.source){ sourceLang = e.parameter.source; } var targetLang = 'en'; if (e.parameter.target){ targetLang = e.parameter.target; } var translatedText = LanguageApp.translate(sourceText, sourceLang, targetLang, {contentType: 'html'}); return ContentService.createTextOutput(translatedText).setMimeType(ContentService.MimeType.JSON); } ``` * Deploy it as webapp for anonymous user * Configure the service URL in the translation provider * Support for translation providers / Add Anchor support. * Support for translation providers / Create one directive for the configuration. Add examples for easier XPath configuration. * Support for translation providers / Improve translation. * Support for translation providers / Fix bad xpath. * Update translationproviders/src/main/java/org/fao/geonet/translations/googletranslate/GoogleTranslateService.java * Update translationproviders/src/main/java/org/fao/geonet/translations/libretranslate/LibreTranslateClientException.java * Update web-ui/src/main/resources/catalog/components/admin/harvester/partials/translate.html * Update web-ui/src/main/resources/catalog/components/admin/harvester/partials/translate.html --------- Co-authored-by: Jose García <[email protected]> * Translation providers - support additional harvesters: GeoNetwork, Local filesystem, OAI-PHM, WebDav --------- Co-authored-by: François Prunayre <[email protected]>
* Support for translation providers in harvesters * Support for translation providers / fix artifact in services/pom.xml * Support for translation providers / directive to select multiple languages * Support for translation providers / update harvester translation and use ACE Editor widget for translation fields configuration * Support for translation providers / refactor directive to select multiple languages to be generic * Support for translation providers / directive to select multiple languages - use a watcher to initialize typeahead when the data is available * Translation providers improvements (#98) * Support for translation providers / Better handle record which may contains other language, add translate all, translate only empty. Also experiment support in suggestion (disabled for now - list of xpath is not supported, only one xpath at a time). * Support for translation providers / Add google translate service * Create a script ```js var mock = { parameter:{ q:'hello', source:'en', target:'fr' } }; function doGet(e) { e = e || mock; var sourceText = '' if (e.parameter.q){ sourceText = e.parameter.q; } var sourceLang = ''; if (e.parameter.source){ sourceLang = e.parameter.source; } var targetLang = 'en'; if (e.parameter.target){ targetLang = e.parameter.target; } var translatedText = LanguageApp.translate(sourceText, sourceLang, targetLang, {contentType: 'html'}); return ContentService.createTextOutput(translatedText).setMimeType(ContentService.MimeType.JSON); } ``` * Deploy it as webapp for anonymous user * Configure the service URL in the translation provider * Support for translation providers / Add Anchor support. * Support for translation providers / Create one directive for the configuration. Add examples for easier XPath configuration. * Support for translation providers / Improve translation. * Support for translation providers / Fix bad xpath. * Update translationproviders/src/main/java/org/fao/geonet/translations/googletranslate/GoogleTranslateService.java * Update translationproviders/src/main/java/org/fao/geonet/translations/libretranslate/LibreTranslateClientException.java * Update web-ui/src/main/resources/catalog/components/admin/harvester/partials/translate.html * Update web-ui/src/main/resources/catalog/components/admin/harvester/partials/translate.html --------- Co-authored-by: Jose García <[email protected]> * Translation providers - support additional harvesters: GeoNetwork, Local filesystem, OAI-PHM, WebDav --------- Co-authored-by: François Prunayre <[email protected]>
…onetwork#8190) * Support for translation providers in harvesters * Support for translation providers / fix artifact in services/pom.xml * Support for translation providers / directive to select multiple languages * Support for translation providers / update harvester translation and use ACE Editor widget for translation fields configuration * Support for translation providers / refactor directive to select multiple languages to be generic * Support for translation providers / directive to select multiple languages - use a watcher to initialize typeahead when the data is available * Translation providers improvements (#98) * Support for translation providers / Better handle record which may contains other language, add translate all, translate only empty. Also experiment support in suggestion (disabled for now - list of xpath is not supported, only one xpath at a time). * Support for translation providers / Add google translate service * Create a script ```js var mock = { parameter:{ q:'hello', source:'en', target:'fr' } }; function doGet(e) { e = e || mock; var sourceText = '' if (e.parameter.q){ sourceText = e.parameter.q; } var sourceLang = ''; if (e.parameter.source){ sourceLang = e.parameter.source; } var targetLang = 'en'; if (e.parameter.target){ targetLang = e.parameter.target; } var translatedText = LanguageApp.translate(sourceText, sourceLang, targetLang, {contentType: 'html'}); return ContentService.createTextOutput(translatedText).setMimeType(ContentService.MimeType.JSON); } ``` * Deploy it as webapp for anonymous user * Configure the service URL in the translation provider * Support for translation providers / Add Anchor support. * Support for translation providers / Create one directive for the configuration. Add examples for easier XPath configuration. * Support for translation providers / Improve translation. * Support for translation providers / Fix bad xpath. * Update translationproviders/src/main/java/org/fao/geonet/translations/googletranslate/GoogleTranslateService.java * Update translationproviders/src/main/java/org/fao/geonet/translations/libretranslate/LibreTranslateClientException.java * Update web-ui/src/main/resources/catalog/components/admin/harvester/partials/translate.html * Update web-ui/src/main/resources/catalog/components/admin/harvester/partials/translate.html --------- * Translation providers - support additional harvesters: GeoNetwork, Local filesystem, OAI-PHM, WebDav --------- Co-authored-by: François Prunayre <[email protected]>
Better handle record which may contains languages
Configuration
Add google translate service
Based on https://stackoverflow.com/questions/8147284/how-to-use-google-translate-api-in-my-java-application
Misc
Checklist
main
branch, backports managed with labelREADME.md
filespom.xml
dependency management. Update build documentation with intended library use and library tutorials or documentation