Opened 16 years ago

Closed 16 years ago

#154 closed task (fixed)

i18n and MySQL: a db function has to be written

Reported by: christoph Owned by: christoph
Priority: critical Milestone: 2.5 release
Component: database Version:
Keywords: Cc:

Description

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;

Change History (4)

comment:1 by astrid_emde, 16 years ago

Owner: changed from mapbender_dev@… to astrid_emde

comment:2 by christoph, 16 years ago

Priority: majorcritical

comment:3 by christoph, 16 years ago

Owner: changed from astrid_emde to christoph

comment:4 by christoph, 16 years ago

Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.