[Mapbender-dev] [Mapbender] #154: i18n and MySQL: a db function has
to be written
Mapbender
info at osgeo.org
Thu Jan 10 05:45:50 EST 2008
#154: i18n and MySQL: a db function has to be written
-----------------------+----------------------------------------------------
Reporter: christoph | Owner: mapbender_dev at lists.osgeo.org
Type: task | Status: new
Priority: major | Milestone: 2.5 release
Component: database | Version:
Keywords: |
-----------------------+----------------------------------------------------
this is the equivalent in PostgreSQL:
-------------------------------------
--
-- new function gettext for easy translations
--
CREATE OR REPLACE FUNCTION gettext(locale_arg "text", string "text")
RETURNS "varchar" AS
$BODY$
DECLARE
msgstr varchar(512);
trl RECORD;
BEGIN
-- RAISE NOTICE '>%<', locale_arg;
SELECT INTO trl * FROM translations
WHERE trim(from locale) = trim(from locale_arg) AND msgid = string;
-- we return the original string, if no translation is found.
-- this is consistent with gettext's behaviour
IF NOT FOUND THEN
RETURN string;
ELSE
RETURN trl.msgstr;
END IF;
END;
$BODY$
LANGUAGE 'plpgsql' VOLATILE;
--
Ticket URL: <http://trac.osgeo.org/mapbender/ticket/154>
Mapbender <http://www.mapbender.org/>
Mapbender
More information about the Mapbender_dev
mailing list