~ubuntu-branches/ubuntu/hardy/kde-l10n-ga/hardy

« back to all changes in this revision

Viewing changes to scripts/kdelibs/kdelibs4/kdelibs4.js

  • Committer: Bazaar Package Importer
  • Author(s): Jonathan Riddell
  • Date: 2008-02-08 11:11:10 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20080208111110-sgdyuk8xs8dapkk7
Tags: 4:4.0.1-0ubuntu1
New upstream release

Show diffs side-by-side

added added

removed removed

Lines of Context:
42
42
//
43
43
// The call always signals fallback.
44
44
//
45
 
function setprops ()
 
45
function setprops (/*...*/)
46
46
{
47
47
    if (arguments.length % 2 != 0)
48
48
        throw Error("Property setter given odd number of arguments.");
69
69
    throw Ts.fallback();
70
70
}
71
71
Ts.setcall("properties", setprops);
 
72
 
 
73
// ------------------------------
 
74
// Standard message dialogs come with cookie-cutter "Yes", "No", etc. buttons,
 
75
// but we can't translate them properly like that.
 
76
// Instead, attach the proper answers to the message caption/text in the PO,
 
77
// and then retrieve them in filtering messages for message dialog buttons
 
78
// in kdelibs4.po (those with context "@action:button filter-...").
 
79
 
 
80
// Dictionary of answers.
 
81
var _answers_ = {};
 
82
 
 
83
// Set answers as key-value pairs, as many as needed.
 
84
// The call always signals fallback.
 
85
function setAnswers (/*...*/)
 
86
{
 
87
    if (arguments.length % 2 != 0)
 
88
        throw Error("Answers setter given odd number of arguments.");
 
89
 
 
90
    for (var i = 0; i < arguments.length; i += 2) {
 
91
        var akey = arguments[i];
 
92
        var answer = arguments[i + 1];
 
93
        _answers_[akey] = answer;
 
94
    }
 
95
 
 
96
    throw Ts.fallback();
 
97
}
 
98
Ts.setcall("set-answers", setAnswers);
 
99
// msgid "Blah, blah...?"
 
100
// msgstr ""
 
101
// "Eh laddy, blah, blah...?"
 
102
// "|/|"
 
103
// "$[set-answers no '&Nay!' yes '&Arr!']"
 
104
 
 
105
// Get an answer by key.
 
106
// Signals fallback if the answer with the given key is not set.
 
107
// Deletes the answer from the dictionary, so that it doesn't happen
 
108
// that it gets retrieved in a later, unrelated question.
 
109
function getAnswer (akey)
 
110
{
 
111
    answer = _answers_[akey];
 
112
    if (!answer) throw Ts.fallback();
 
113
    delete _answers_[akey];
 
114
    return answer;
 
115
}
 
116
Ts.setcall("get-answer", getAnswer);
 
117
// msgctxt "@action:button filter-yes"
 
118
// msgid "%1"
 
119
// msgstr "%1|/|$[get-answer yes]"
 
120
 
 
121
// Reset all answers, so that they don't get used for the wrong question.
 
122
// Always signals fallback.
 
123
function resetAnswers ()
 
124
{
 
125
    _answers_ = {};
 
126
}
 
127
Ts.setcall("reset-answers", resetAnswers);
 
128
// msgctxt "@action:button post-filter"
 
129
// msgid "."
 
130
// msgstr ".|/|$[reset-answers]"
 
131