Skip to content
Snippets Groups Projects
Commit 14101226 authored by Per Hedbor's avatar Per Hedbor
Browse files

More compatibility

Rev: lib/modules/Locale.pmod/module.pmod:1.7
parent 9e501bc0
No related branches found
No related tags found
No related merge requests found
...@@ -410,12 +410,27 @@ class DeferredLocale( static string project, ...@@ -410,12 +410,27 @@ class DeferredLocale( static string project,
return ({ project, get_lang, key, fallback }); return ({ project, get_lang, key, fallback });
} }
static int `<( mixed what )
{
return lookup() < what;
}
static int `> ( mixed what )
{
return lookup() > what;
}
static int `==( mixed what )
{
return lookup() == what;
}
static inline string lookup() static inline string lookup()
{ {
return translate(project, get_lang(), key, fallback); return translate(project, get_lang(), key, fallback);
} }
string _sprintf(int c) static string _sprintf(int c)
{ {
switch(c) switch(c)
{ {
...@@ -427,43 +442,44 @@ class DeferredLocale( static string project, ...@@ -427,43 +442,44 @@ class DeferredLocale( static string project,
error(sprintf("Illegal formatting char '%c'\n", c)); error(sprintf("Illegal formatting char '%c'\n", c));
} }
} }
string `+(mixed ... args) static string `+(mixed ... args)
{ {
return predef::`+(lookup(), @args); return predef::`+(lookup(), @args);
} }
string ``+(mixed ... args) static string ``+(mixed ... args)
{ {
return predef::`+(@args, lookup()); return predef::`+(@args, lookup());
} }
int _sizeof() static int _sizeof()
{ {
return sizeof(lookup()); return sizeof(lookup());
} }
int|string `[](int a,int|void b) static int|string `[](int a,int|void b)
{ {
if (query_num_arg() < 2) { if (query_num_arg() < 2) {
return lookup()[a]; return lookup()[a];
} }
return lookup()[a..b]; return lookup()[a..b];
} }
array(string) `/(string s) static array(string) `/(string s)
{ {
return lookup()/s; return lookup()/s;
} }
array(int) _indices() static array(int) _indices()
{ {
return indices(lookup()); return indices(lookup());
} }
array(int) _values() static array(int) _values()
{ {
return values(lookup()); return values(lookup());
} }
mixed cast(string to) static mixed cast(string to)
{ {
if(to=="string") return lookup(); if(to=="string") return lookup();
if(to=="mixed" || to=="object") return this_object();
throw( ({ "Cannot cast DeferredLocale to "+to+".\n", backtrace() }) ); throw( ({ "Cannot cast DeferredLocale to "+to+".\n", backtrace() }) );
} }
int _is_type(string type) { static int _is_type(string type) {
return type=="string"; return type=="string";
} }
}; };
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment