Language selection tool

New features which should be implemented in Porteus; suggestions are welcome. All questions or problems with testing releases (alpha, beta, or rc) should go in their relevant thread here, rather than the Bug Reports section.

Re: Language selection tool

Postby brokenman » 04 Oct 2016, 02:49

Thanks. I've updated the first post.

http://brokenman.porteus.org/i18n/
How do i become super user?
Wear your underpants on the outside and put on a cape.
brokenman
Site Admin
Site Admin
 
Posts: 5333
Joined: 27 Dec 2010, 04:50
Location: Brazil
Distribution: Porteus v3.2rcX all desktops

Re: Language selection tool

Postby port » 06 Oct 2016, 12:14

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)
port
Black ninja
Black ninja
 
Posts: 82
Joined: 18 Feb 2016, 10:25
Location: Spain
Distribution: Linux porteus 3.2.2 KDE

Re: Language selection tool

Postby brokenman » 07 Oct 2016, 02:57

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.
brokenman
Site Admin
Site Admin
 
Posts: 5333
Joined: 27 Dec 2010, 04:50
Location: Brazil
Distribution: Porteus v3.2rcX all desktops

Re: Language selection tool

Postby port » 07 Oct 2016, 11:19

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 ;)
port
Black ninja
Black ninja
 
Posts: 82
Joined: 18 Feb 2016, 10:25
Location: Spain
Distribution: Linux porteus 3.2.2 KDE

Re: Language selection tool

Postby brokenman » 07 Oct 2016, 23:34

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
How do i become super user?
Wear your underpants on the outside and put on a cape.
brokenman
Site Admin
Site Admin
 
Posts: 5333
Joined: 27 Dec 2010, 04:50
Location: Brazil
Distribution: Porteus v3.2rcX all desktops

Re: Language selection tool

Postby Rava » 11 Oct 2016, 22:40

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
Cheers!
Yours Rava
User avatar
Rava
Contributor
Contributor
 
Posts: 1225
Joined: 11 Jan 2011, 03:46
Location: Germany
Distribution: Porteus 3.1.0 x86-64 XFCe

Re: Language selection tool

Postby brokenman » 12 Oct 2016, 03:20

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.
brokenman
Site Admin
Site Admin
 
Posts: 5333
Joined: 27 Dec 2010, 04:50
Location: Brazil
Distribution: Porteus v3.2rcX all desktops

Re: Language selection tool

Postby Rava » 12 Oct 2016, 04:18

^
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.
Cheers!
Yours Rava
User avatar
Rava
Contributor
Contributor
 
Posts: 1225
Joined: 11 Jan 2011, 03:46
Location: Germany
Distribution: Porteus 3.1.0 x86-64 XFCe

Re: Language selection tool

Postby brokenman » 14 Oct 2016, 23:06

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.
brokenman
Site Admin
Site Admin
 
Posts: 5333
Joined: 27 Dec 2010, 04:50
Location: Brazil
Distribution: Porteus v3.2rcX all desktops

Re: Language selection tool

Postby Rava » 15 Nov 2016, 08:25

brokenman wrote:Thanks Rava. I've added the suggestion lines to my local copy.

And hopefully that will included in the final version? Image
Cheers!
Yours Rava
User avatar
Rava
Contributor
Contributor
 
Posts: 1225
Joined: 11 Jan 2011, 03:46
Location: Germany
Distribution: Porteus 3.1.0 x86-64 XFCe

Re: Language selection tool

Postby brokenman » 15 Nov 2016, 14:47

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?
How do i become super user?
Wear your underpants on the outside and put on a cape.
brokenman
Site Admin
Site Admin
 
Posts: 5333
Joined: 27 Dec 2010, 04:50
Location: Brazil
Distribution: Porteus v3.2rcX all desktops

Re: Language selection tool

Postby Rava » 17 Nov 2016, 20:56

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...
Cheers!
Yours Rava
User avatar
Rava
Contributor
Contributor
 
Posts: 1225
Joined: 11 Jan 2011, 03:46
Location: Germany
Distribution: Porteus 3.1.0 x86-64 XFCe

Re: Language selection tool

Postby brokenman » 18 Nov 2016, 00:38

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.
brokenman
Site Admin
Site Admin
 
Posts: 5333
Joined: 27 Dec 2010, 04:50
Location: Brazil
Distribution: Porteus v3.2rcX all desktops

Re: Language selection tool

Postby derixithy » 05 Dec 2016, 18:56

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
My Portable Apps: http://appcdn.usershare.nl
My Porteus Modules: http://porteus.usershare.nl
User avatar
derixithy
White ninja
White ninja
 
Posts: 9
Joined: 27 Mar 2015, 01:49
Location: Netherlands
Distribution: Mostyl debian/ubuntu based

Re: Language selection tool

Postby Rava » 13 Dec 2016, 03:23

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)
Cheers!
Yours Rava
User avatar
Rava
Contributor
Contributor
 
Posts: 1225
Joined: 11 Jan 2011, 03:46
Location: Germany
Distribution: Porteus 3.1.0 x86-64 XFCe

PreviousNext

Return to Development



Who is online

Users browsing this forum: No registered users and 2 guests