Page 3 of 4

Re: Language selection tool

Posted: 04 Oct 2016, 01:49
by brokenman
Thanks. I've updated the first post.

http://brokenman.porteus.org/i18n/

Re: Language selection tool

Posted: 06 Oct 2016, 11:14
by port
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:

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
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)

Re: Language selection tool

Posted: 07 Oct 2016, 01:57
by brokenman
Thanks port. I have a script here I use for auto translations, but inevitably the files need a human eye.

Re: Language selection tool

Posted: 07 Oct 2016, 10:19
by port
brokenman wrote:I have a script here I use for auto translations, but inevitably the files need a human eye.
May you share your script? I feel it may help to get people translating (also a translation needed/wanted list ;)

Re: Language selection tool

Posted: 07 Oct 2016, 22:34
by brokenman
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 <brokenman@porteus.org
# 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

Re: Language selection tool

Posted: 11 Oct 2016, 21:40
by Rava
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; }
I think this should read:

Code: Select all

# Run this script with the arguments infile.po outfile.po
# Example: script.sh myfile.po english.po

Re: Language selection tool

Posted: 12 Oct 2016, 02:20
by brokenman

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

Re: Language selection tool

Posted: 12 Oct 2016, 03:18
by Rava
^
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.
:D

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
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

Code: Select all

export COLUMNS
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.

Re: Language selection tool

Posted: 14 Oct 2016, 22:06
by brokenman
Thanks Rava. I've added the suggestion lines to my local copy.

Re: Language selection tool

Posted: 15 Nov 2016, 07:25
by Rava
brokenman wrote:Thanks Rava. I've added the suggestion lines to my local copy.
And hopefully that will included in the final version? Image

Re: Language selection tool

Posted: 15 Nov 2016, 13:47
by brokenman
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?

Re: Language selection tool

Posted: 17 Nov 2016, 19:56
by Rava
brokenman wrote:Do you suggest that it ships with Porteus?
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...

Re: Language selection tool

Posted: 17 Nov 2016, 23:38
by brokenman
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.

Re: Language selection tool

Posted: 05 Dec 2016, 17:56
by derixithy
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

Re: Language selection tool

Posted: 13 Dec 2016, 02:23
by Rava
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.
I want it system-wide exported.

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)