Gargoyle localization

Discuss the technical details of Gargoyle and ongoing development

Moderator: Moderators

Progman
Posts: 4
Joined: Fri Sep 16, 2011 8:24 am

Gargoyle localization

Post by Progman »

How to localize Gargoyle in Russian? I want to do it.

behappy
Posts: 83
Joined: Thu Mar 31, 2011 5:06 pm

Re: Gargoyle localization

Post by behappy »

Progman wrote:How to localize Gargoyle in Russian? I want to do it.


Get access to routers file structure ex. winscp then those folders; etc, www. Take a look at http://eko.one.pl
Those guys have translated it to polish. I just translate it back to english because their version supports 3G WAN w. nice GUI setup.

wwenigma
Posts: 16
Joined: Wed May 01, 2013 4:51 am

Re: Gargoyle localization

Post by wwenigma »

Hello!

I want to ask, how to localize gargoyle without editing .sh stuffs in installed version? Maybe there is a plugin interface or something to install localized lnguage? (I want to translate it to hungarian. :) )

Or after clone git to local, edit that .sh files https://github.com/ericpaulbishop/gargo ... /files/www and than make firmware? (1043ND for me)

thanks!

BashfulBladder
Moderator
Posts: 250
Joined: Thu Jan 17, 2013 11:43 pm

Re: Gargoyle localization

Post by BashfulBladder »

I think there was a single file that could be translated - but that seems to have disappeared. The only way to do it now is the manual file.sh-by-file.sh method.
TP-Link WDR3600 v1.1 running 1.5.10+ L10n-English (Built 20130922 - OpenWrt r38093)
TP-Link WDR4300 running 1.5.10+ i18n-English (Built 20131010 - OpenWrt r38286)

https://github.com/BashfulBladder/gargoyle-plugins/wiki

Cezary
Posts: 135
Joined: Thu Sep 11, 2008 12:57 pm
Location: Poland
Contact:

Re: Gargoyle localization

Post by Cezary »

Mine? http://ecco.selfip.net/gargoyle-pl/attitude_adjustment/

.sh files, .js files and menu in /etc/config. Some other like files from ddns, openvpn etc.

wwenigma
Posts: 16
Joined: Wed May 01, 2013 4:51 am

Re: Gargoyle localization

Post by wwenigma »

Cezary wrote:Mine?


Thanks, so this contains all phrases what need to translate. How to use them? :oops:

User avatar
powerlogy
Posts: 66
Joined: Wed Aug 22, 2012 12:04 pm
Location: Turkey

Re: Gargoyle localization

Post by powerlogy »

Sure i can contribute too.But first gargoyle web interface needs a support for multi language.

BashfulBladder
Moderator
Posts: 250
Joined: Thu Jan 17, 2013 11:43 pm

Re: Gargoyle localization

Post by BashfulBladder »

Coming soon: Gargoyle with i18n support (with any luck). Because a picture is worth a thousand i18n words:

https://raw.github.com/wiki/BashfulBlad ... s/i18n.avi

Pay attention to the names of the buttons on the bottom of the Time page.

Code: Select all

      <input type='button' value=<? /sbin/i18n "UI.SaveChanges" ?> id="save_button" class="bottom_button" onclick='saveChanges()' />
      <input type='button' value=<? /sbin/i18n "UI.Reset" ?> id="reset_button" class="bottom_button" onclick='resetData()'/>


If anybody has any better ideas of the server-side haserl structure (to make it shorter, because there are LOTS of strings), chime in.

If you are a native speaker of one of those languages - I apologize for the butchered translations.

And ignore the theme (and the way ffmpeg oversaturated the green).
TP-Link WDR3600 v1.1 running 1.5.10+ L10n-English (Built 20130922 - OpenWrt r38093)
TP-Link WDR4300 running 1.5.10+ i18n-English (Built 20131010 - OpenWrt r38286)

https://github.com/BashfulBladder/gargoyle-plugins/wiki

BashfulBladder
Moderator
Posts: 250
Joined: Thu Jan 17, 2013 11:43 pm

Re: Gargoyle localization

Post by BashfulBladder »

There is a huge performance penalty with haserl <% script %> injections. Save this to a file called intl, chmod +x it and put it in $PATH on the router - /sbin/intl
--------------------------------

Code: Select all

#!/bin/sh

local ikey="$1"
lang=$(uci get gargoyle.global.language)
local key=$(echo "$ikey" | awk -F '.' '{print $2}')
   
echo "$key"


-------------------------
duplicate the time.sh to time2.sh and add this 20 times in innerhtml:
<? intl "time.TimeZone" ?>
20 of that simple script visibly slows down page loading. Throw in awk searching a file 20 times (and it isn't cached - each script call is a fork & a subshell opens for each time) and page loading is at least a second longer with the genuine i18n shell script:
-------------------

Code: Select all

local ikey="$1"
local lfile=$(echo "$ikey" | awk -F '.' '{print $1}')
local web_root=$(uci get gargoyle.global.web_root)
local lang=$(uci get gargoyle.global.language)
local fallback_lang=$(uci -q get gargoyle.global.fallback_lang)
local target_file="$web_root/i18n/$lang/$lfile.txt"
local translation
   
[ -e "$target_file" ] && translation=$(awk -v key="$ikey" -F '=' '$0 ~ key { print $2 }' "$target_file")
[ -z "$translation" ] && {
   target_file="$web_root/i18n/$fallback_lang/$lfile.txt"
   [ -e "$target_file" ] && translation=$(awk -v key="$ikey" -F '=' '$0 ~ key { print $2 }' "$target_file")
}
[ -z "$translation" ] && translation=$(echo "$ikey" | awk -F '.' '{print $2}')
echo "$translation"


----------------

So I can think of 3 solutions:
mod harserl to support caching of the translation files
mod haserl to do direct lookups
use javascript to hold variables & window.onload to fill in variables

I think #2 is the best course.
• Define a new syntax <~ UI.SaveButton ~>
• integrate uci lookups for fallback_lang & language - or env variables, or pass them by argument like haserl $(uci get gargoyle.global.language)
TP-Link WDR3600 v1.1 running 1.5.10+ L10n-English (Built 20130922 - OpenWrt r38093)
TP-Link WDR4300 running 1.5.10+ i18n-English (Built 20131010 - OpenWrt r38286)

https://github.com/BashfulBladder/gargoyle-plugins/wiki

wwenigma
Posts: 16
Joined: Wed May 01, 2013 4:51 am

Re: Gargoyle localization

Post by wwenigma »

BashfulBladder wrote:Coming soon: Gargoyle with i18n support (with any luck).


Thank you!

Post Reply