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 , 16 years ago
Owner: | changed from | to
---|
comment:2 by , 16 years ago
Priority: | major → critical |
---|
comment:3 by , 16 years ago
Owner: | changed from | to
---|
comment:4 by , 16 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |