Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

10.4: Change default languages for the Translation widget System 10.4
I often use the Translation widget to translate from English to French, and the reverse. By default, when I choose English, it puts Chinese as the default translation to, and from French, it is Netherland. I had to change the translate to each time I changed languages.

So, I opened the /Library -> Widgets -> Translation.wdgt (control-click on it and choose Show Package Contents), and opened the Translation.js file in the Contents folder. At the begining of the file, there are a few var declarations for each language. So I selected the English declaration, and cut and paste the fr into the first position, and for French, I place en in first:
var English = [
var French = ['en','nl','de','el','it','pt','es'];
Now when I switch the Translate From language menu to English or French, I always have the good Translate To language selected. That saves me lots of time in my day!

[robg adds: I always recommend copying the system widgets to your user's Library/Widgets folder before modifying them. The modified user-level widget will take precedence over the system widget, and you've automatically got a clean original in the original location.]
  • Currently 3.17 / 5
  You rated: 5 / 5 (6 votes cast)

10.4: Change default languages for the Translation widget | 2 comments | Create New Account
Click here to return to the '10.4: Change default languages for the Translation widget' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
10.4: Change default languages for the Translation widget
Authored by: morespace54 on Aug 14, '06 11:19:23AM

Neat... Works like a charm... until a new version of the Widget comes out I guess...

[ Reply to This | # ]
10.4: Change default languages for the Translation widget
Authored by: tota on Aug 17, '06 04:57:08AM

For the German speaking people all over the world.
If you want the sequence to be as follows, use the text snippet below and replace the same part inside the Translation.js.

Default language from: German
Default language to: English
Choosable from languages: en, de, fr, it
Translationable languages: en, de, fr, it

Text part to be changed in Translation.jar:
**** Start of text snippet below this line****

var ChineseS = ['en'];
var ChineseT = ['en'];
var Dutch = ['en','fr'];
var English = ['de','fr','it'];/*,'zh-Hans','zh-Hant','nl','el','ja','ko','pt','ru','es'*/
var French = ['de','en','it'];/*,'nl','el','pt','es'*/
var German = ['en','fr','it'];
var Greek = ['en','fr'];
var Italian = ['de','en','fr'];
var Japanese = ['en'];
var Korean = ['en'];
var Portuguese = ['en','fr'];
var Russian = ['en'];
var Spanish = ['en', 'fr'];

var languageData = [
{name:'English', code:"en", iso:"en", array:English},
{name:'German', code:"de", iso:"de", array:German},
{name:'French', code:"fr", iso:"fr", array:French},
{name:'Italian', code:"it", iso:"it", array:Italian},
/*{name:'Chinese (Simplified)', code:"zh", iso:"zh-Hans", array:ChineseS},
{name:'Chinese (Traditional)', code:"zt", iso:"zh-Hant", array:ChineseT},
{name:'Dutch', code:"nl", iso:"nl", array:Dutch},
{name:'Greek', code:"el", iso:"el", array:Greek},
{name:'Japanese', code:"ja", iso:"ja", array:Japanese},
{name:'Korean', code:"ko", iso:"ko", array:Korean},
{name:'Portuguese', code:"pt", iso:"pt", array:Portuguese},
{name:'Russian', code:"ru", iso:"ru", array:Russian},
{name:'Spanish', code:"es", iso:"es", array:Spanish}*/

var resizeAnimation = {startTime:0, duration:250, timer:null, list:null, onfinished:null};

var defaultFromLanguage = 1; // use English as the default from language
var defaultToLanguage = 3; // use German as the default to language
**** End of text snippet above this line*****

If you prefer other languages then play around with the available language codes inside the "var ..... = [" fileds where "....." stays for your language and with the sequence of the "var languageData = [{name:'....'" fields.

Under "var defaultFromLanguage = " you can set a number which reflects the possition of the desired language inside the "var languageData = [ ...... ];" field. The same applies to "var defaultToLanguage = ".

Don't change the sequence of the top "var 'Language'" fields as the're be used somewhere else and if changed make the widget unusable.

So that's all about it and now you have your own translation widget behaviour.

Have fun and greetings from Switzerland
Thomas Thaler

[ Reply to This | # ]