Last active
February 4, 2020 23:42
-
-
Save shawnfeng0/b6b9134a33a5e72ee3c327dac0f312ee to your computer and use it in GitHub Desktop.
Package trans command line translation software to realize automatic translation into Chinese when the input language is English
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
target_language=$(trans -id ${!#} | sed -r "s/\x1B\[([0-9]{1,2}(;[0-9]{1,2})*)?m//g" | awk '$1=="Code" && $2!="zh-CN" {printf ":zh-CN"}') | |
trans $target_language "$@" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment