Language selection tool
- brokenman
- Site Admin
- Posts: 6105
- Joined: 27 Dec 2010, 03:50
- Distribution: Porteus v4 all desktops
- Location: Brazil
Re: Language selection tool
How do i become super user?
Wear your underpants on the outside and put on a cape.
Wear your underpants on the outside and put on a cape.
-
- Samurai
- Posts: 137
- Joined: 18 Feb 2016, 09:25
- Distribution: Linux porteus 3.2.2 KDE
- Location: Spain
Re: Language selection tool
Here you are spanish translation
https://transfer.sh/KUzJi/es-gtk-language-selection.po
and also a quick & dirty script for easy translations of such files, it depends on trans script and provides auto translations of all one line texts inside the pot file and you can run it also in manual mode so you can proofread and rewrite auto translations provided
https://transfer.sh/h4INn/tr-pot.sh
the use of this dirty scripty is something like this:
the answer to the change? question may be 'y' 'yes' 'Y' or 'YES' to enter a new text or whatever to avoid changes. There's a -v option for a more verbose output. If no language code is provided it defaults to spanish (es)
https://transfer.sh/KUzJi/es-gtk-language-selection.po
and also a quick & dirty script for easy translations of such files, it depends on trans script and provides auto translations of all one line texts inside the pot file and you can run it also in manual mode so you can proofread and rewrite auto translations provided
https://transfer.sh/h4INn/tr-pot.sh
the use of this dirty scripty is something like this:
Code: Select all
$ ./tr-pot.sh file-to-translate.pot pt
$ ./tr-pot.sh file-to-translate.pot pt -m
english: Development locales
current: locais de desenvolvimento
change?
english: You files: /tmp/language-files
current: Você arquivos: / tmp / língua-files
change? y
pt text? Seus arquivos: /tmp/language-files
- brokenman
- Site Admin
- Posts: 6105
- Joined: 27 Dec 2010, 03:50
- Distribution: Porteus v4 all desktops
- Location: Brazil
Re: Language selection tool
Thanks port. I have a script here I use for auto translations, but inevitably the files need a human eye.
How do i become super user?
Wear your underpants on the outside and put on a cape.
Wear your underpants on the outside and put on a cape.
-
- Samurai
- Posts: 137
- Joined: 18 Feb 2016, 09:25
- Distribution: Linux porteus 3.2.2 KDE
- Location: Spain
Re: Language selection tool
May you share your script? I feel it may help to get people translating (also a translation needed/wanted listbrokenman wrote:I have a script here I use for auto translations, but inevitably the files need a human eye.

- brokenman
- Site Admin
- Posts: 6105
- Joined: 27 Dec 2010, 03:50
- Distribution: Porteus v4 all desktops
- Location: Brazil
Re: Language selection tool
The binary 'trans' is required.
Code: Select all
#!/bin/bash
# Script to auto translate msgstr "" tags in a .po file
# using google translator
#
# Run this script with the argument file.po
# Example: script.sh myfile.po
# Author: brokenman <[email protected]
# Date: Jan 2013
L1=$2
L2=$3
[ $# -ne 3 ] && { echo "You need two arguments. $0 file.po en pt"; exit; }
! which trans && { echo "You need to download trans. wget git.io/trans"; exit; }
translate(){
#/usr/local/bin/trans -shell -brief -s $L2 -t $L3 "$EN" | tail -n1
trans -b :${L2} "$EN"
}
[ -z $1 ] && { echo; echo "You must supply a .po file!"; exit; }
SAVEIFS=$IFS
IFS=$(echo -en "\n\b")
for a in `grep -rne msgid $1`; do
EN=`awk -F'"' '{print$2}' <<<$a`
if [[ -z $EN ]]; then continue; fi
echo -e "Translating \""$EN"\""
declare -i NUMBER=`awk -F: '{print$1}' <<<$a`
(( NUMBER++ ))
TR=`translate "$EN"`
echo "$TR"
sed -i "$NUMBER s|\"\"|\"$TR\"|" $1
unset ID EN TR NUMBER
done
IFS=$SAVEIFS
How do i become super user?
Wear your underpants on the outside and put on a cape.
Wear your underpants on the outside and put on a cape.
- Rava
- Contributor
- Posts: 5424
- Joined: 11 Jan 2011, 02:46
- Distribution: XFCE 5.01 x86_64 + 4.0 i586
- Location: Forests of Germany
Re: Language selection tool
I think this should read:brokenman wrote:Code: Select all
# Run this script with the argument file.po # Example: script.sh myfile.po [...] [ $# -ne 3 ] && { echo "You need two arguments. $0 file.po en pt"; exit; }
Code: Select all
# Run this script with the arguments infile.po outfile.po
# Example: script.sh myfile.po english.po
Cheers!
Yours Rava
Yours Rava
- brokenman
- Site Admin
- Posts: 6105
- Joined: 27 Dec 2010, 03:50
- Distribution: Porteus v4 all desktops
- Location: Brazil
Re: Language selection tool
Code: Select all
# Run this script with the arguments infile.po <L1> <L2> (Where L1 is first language and L2 is target language)
# Example: script.sh myfile.po en pt
How do i become super user?
Wear your underpants on the outside and put on a cape.
Wear your underpants on the outside and put on a cape.
- Rava
- Contributor
- Posts: 5424
- Joined: 11 Jan 2011, 02:46
- Distribution: XFCE 5.01 x86_64 + 4.0 i586
- Location: Forests of Germany
Re: Language selection tool
^
Okay,my bad. maybe in the text the script prints as error / help, use more examples and explain, e.g.:

Even better, with the downsize that a script by default is not able to read $COLUMNS, you have to export COLUMNS .
To do so, put
in your /etc/profile and log into a new console/terminal.
Then one could use a script that either uses $COLUMNS (if defined, aka if it holds a value) or else revert to 80 chars by default as backup.
Okay,my bad. maybe in the text the script prints as error / help, use more examples and explain, e.g.:
Code: Select all
echo Examples:
echo script.sh myfile.po en pt
echo Translate myfile.po from English into Portuguese
echo
echo script.sh myfile.po de en
echo Translate myfile.po from German into English
echo
echo Cave! Know that Google Translate always translates into English first, then into the target language, therefore often the translation gets bad when the target (or source) language is not English. Often if you are apt in English, use English as target language and translate manually from there.

Code: Select all
echo "Cave! Know that Google Translate always translates into English first, then into the target language, therefore often the translation gets bad when the target (or source) language is not English. Often if you are "|fold -sw 80
To do so, put
Code: Select all
export COLUMNS
Then one could use a script that either uses $COLUMNS (if defined, aka if it holds a value) or else revert to 80 chars by default as backup.
Cheers!
Yours Rava
Yours Rava
- brokenman
- Site Admin
- Posts: 6105
- Joined: 27 Dec 2010, 03:50
- Distribution: Porteus v4 all desktops
- Location: Brazil
Re: Language selection tool
Thanks Rava. I've added the suggestion lines to my local copy.
How do i become super user?
Wear your underpants on the outside and put on a cape.
Wear your underpants on the outside and put on a cape.
- Rava
- Contributor
- Posts: 5424
- Joined: 11 Jan 2011, 02:46
- Distribution: XFCE 5.01 x86_64 + 4.0 i586
- Location: Forests of Germany
Re: Language selection tool
And hopefully that will included in the final version?brokenman wrote:Thanks Rava. I've added the suggestion lines to my local copy.

Cheers!
Yours Rava
Yours Rava
- brokenman
- Site Admin
- Posts: 6105
- Joined: 27 Dec 2010, 03:50
- Distribution: Porteus v4 all desktops
- Location: Brazil
Re: Language selection tool
And hopefully that will included in the final version?
No, no. This is a part of my build scripts that I use locally. Not a script that ships with Porteus.
Do you suggest that it ships with Porteus?
No, no. This is a part of my build scripts that I use locally. Not a script that ships with Porteus.
Do you suggest that it ships with Porteus?
How do i become super user?
Wear your underpants on the outside and put on a cape.
Wear your underpants on the outside and put on a cape.
- Rava
- Contributor
- Posts: 5424
- Joined: 11 Jan 2011, 02:46
- Distribution: XFCE 5.01 x86_64 + 4.0 i586
- Location: Forests of Germany
Re: Language selection tool
If Porteus, by default, exports the COLUMNS, then all scripts running with Porteus could use that info. Of course that means that the script writers have to know about it, but if they do, many users would appreciate it, since many people use >80 columns, me thinks...brokenman wrote:Do you suggest that it ships with Porteus?
Cheers!
Yours Rava
Yours Rava
- brokenman
- Site Admin
- Posts: 6105
- Joined: 27 Dec 2010, 03:50
- Distribution: Porteus v4 all desktops
- Location: Brazil
Re: Language selection tool
Now I'm confused. Are you talking about including the script in Porteus or just exporting the variable system wide? I disagree with exporting the COLUMN variable as this is a thing many coders want to set for themselves.
How do i become super user?
Wear your underpants on the outside and put on a cape.
Wear your underpants on the outside and put on a cape.
- derixithy
- White ninja
- Posts: 10
- Joined: 27 Mar 2015, 00:49
- Distribution: Mostyl debian/ubuntu based
- Location: Netherlands
Re: Language selection tool
Here is a dutch (nl_NL) po file. I also made a Frisian one, but besides me there probably won't be anyone else who is going to use it (If there is, call out to me).
https://drive.google.com/file/d/0B3F_Fv ... sp=sharing
-- edit --
Added language code
https://drive.google.com/file/d/0B3F_Fv ... sp=sharing
-- edit --
Added language code
My Portable Apps: http://appcdn.usershare.nl
My Porteus Modules: http://porteus.usershare.nl
My Porteus Modules: http://porteus.usershare.nl
- Rava
- Contributor
- Posts: 5424
- Joined: 11 Jan 2011, 02:46
- Distribution: XFCE 5.01 x86_64 + 4.0 i586
- Location: Forests of Germany
Re: Language selection tool
I want it system-wide exported.brokenman wrote:Now I'm confused. Are you talking about including the script in Porteus or just exporting the variable system wide? I disagree with exporting the COLUMN variable as this is a thing many coders want to set for themselves.
Then tell me, how do the coders solve that issue? I only know the solution that it is exported into the running shell prior running the script.
When you test something in the shell itself (not in a script) you don't need it exported. But I know of no trick for any bash script to be able to read $COLUMNS
(Yes, there needs to be an "S" at the end)
Cheers!
Yours Rava
Yours Rava