tldrtranslate
tldrtranslate

ikks/tldrtranslate

MIT

A helper on tldrtranslation that uses argos

4 4 1 0
3
build.zig.zon  build.zig 
View on Github  
Updated: 8:43:49 PM Tue Nov 26 2024 Size: 431KB Created: 11:57:05 PM Thu Nov 21 2024
Dependencies:
clap
Supports Zig Version 0.13.0
zig  fetch  --save  git+https://github.com/ikks/tldrtranslate

tldrtranshelper

This is a helper to translate tldr pages, the list of supported languages is:

https://github.com/user-attachments/assets/b81b3895-aa8d-443b-84d5-057d9ecc4041

  • ar
  • bn
  • ca
  • cs
  • da
  • de
  • es
  • fa
  • fi
  • fr
  • hi
  • id
  • it
  • ja
  • ko
  • nl
  • pl
  • pt_BR
  • pt_PT
  • ro
  • ru
  • sv
  • th
  • tr
  • uk
  • zh
  • zh_TW

The workflow is:

  • tldrtranslate translates from English to the language you desire.
  • With your team, you can fix the output and make a pull request.

Download and usage

  • Download for your platform from the releases page, take the latest one.
  • Download argostranslate API and argostranslate and make the API run.

If you are having problems getting the API and argos-translate to run, please ask in https://app.element.io/#/room/#tldr-pages:matrix.org , maybe there is someone that can put a server for your use.

Running

Suppose you aim to translate pages/common/argos-translate.md to it , you will run:

tldrtranslate -l it pages/common/argos-translate.md

tldrtranslate will output the translation to pages.it/common/argos-translate.md, overwriting the file if it existed

You can use relative or absolute paths, as soon as you include the hierarchy from pages directory.

You can set the following ENV_VARS to change the default configurations:

  • TLDR_LANG: defaults to es (spanish)
  • TLDR_ARGOS_API_URLBASE: defaults to localhost
  • TLDR_ARGOS_API_PORT: Defaults to 8000

each one of them is superseeded by the option of the command line

  • -l es
  • -u localhost
  • -p 8000

Building from source

  • You need zig 0.13.0 to compile tldrtranslate
  • Clone this repository

And issue

zig build

Under zig-out/bin/ should be present tldrtranslate for your use.

  • argos-API translate instance running, in port 8000
  • For spanish data to tweak the verb inflection

Feel free to clone and modify to suit your needs.

Running an Argos API instance

You will need to have python, argos-translate and api argos-translate or Docker and some Gigas of space for the models and the needed infrastructure.

Have an Argos-API locally. To run it, with your language pairs you can issue on your virtualenv:

fastapi dev main

Building a new language

If your language is in the list of supported languages by Argos-translate, just download the required package to your running environment. For example for portuguese argospm install translate-en_pt, is the same for PT or BR.

If your language is not supported by Argos-translate, you can open an issue in Argos-translate.

Adding common replacements for your language

If you want to have consistent translations, there are some words that can be replaced befor the translation process, please look here.

Acknowledgments

Resources

TODO

  • Make sure Windows is supported.
  • Make sure macOS is supported.
  • Automate releases for different platforms.
  • Documentation to add a new language.
  • Add -p --preview option , instead of writing the file, show in stdout.
  • Add colors to the stdout output.
  • Continuous integration.
  • Continuous delivery.
  • Postprocess Spanish translation to use singular third person when argos-translate outputs infinitive or imperative translation verb form.