KO
|
EN
gitlite — search
Search
#php
#javascript
#python
#css
#android
#java
#raspberry-pi
#c
#mysql
#game
#cryptography
#library
translate-html
★ 60
Open GitHub ↗
Translate HTML using Argos Translate
Download README (.md)
Explore Similar Repositories
dcase-few-shot-bioacoustic
:
No description available.
KafkaConfluentRESTProxyAdapter1C
:
No description available.
iot-dc-server
:
基于Spring Cloud的开源可分布式物联网(IOT)平台,用于快速开发、部署物联设备接入项目,是一整套物联系统解决方案。
sort-tab
:
Smarter tab solution for Emacs, sort tab with using frequency.
pytorch-ddp-examples
:
No description available.
// repository documentation
Was this content helpful?
★ 0
(0 ratings)
Select Rating:
★
★
★
★
★
Submit Feedback
Recent Feedback
×
Download README
Do you want to download the
README.md
file for
translate-html
?
Download (.md)
# translate-html Translate HTML using [Beautiful Soup](https://beautiful-soup-4.readthedocs.io/en/latest/) and [Argos Translate](https://github.com/argosopentech/argos-translate) ## Install ``` pip install translatehtml ``` ## [Example](examples/) ```python import argostranslate.package, argostranslate.translate import translatehtml from_code = "es" to_code = "en" html_doc = """<div><h1>Perro</h1></div>""" # Download and install Argos Translate package available_packages = argostranslate.package.get_available_packages() available_package = list( filter( lambda x: x.from_code == from_code and x.to_code == to_code, available_packages ) )[0] download_path = available_package.download() argostranslate.package.install_from_path(download_path) # Translate installed_languages = argostranslate.translate.get_installed_languages() from_lang = list(filter(lambda x: x.code == from_code, installed_languages))[0] to_lang = list(filter(lambda x: x.code == to_code, installed_languages))[0] translation = from_lang.get_translation(to_lang) translated_soup = translatehtml.translate_html(translation, html_doc) print(translated_soup) ``` ## Links - [OpenNMT Forum](https://forum.opennmt.net/t/suggestions-for-translating-xml/4409) - [GitHub Discussion](https://github.com/argosopentech/argos-translate/discussions/158)