-- Note that these operators are NOT added to the i18n schema, 
-- 	because they are limitted to acting on our custom type
-- 	and are more convenient to use this way.
-- If you intend to use "Set search_path", adding them to the 
--	i18n schema may be preferable for tidiness.

-- Basic translation
-- e.g. Select column -> 'en' ...
Create Operator ->
(
	LEFTARG = i18n.translated_text,
	RIGHTARG = text,
	PROCEDURE = i18n.translate
);

-- Session-based translation
-- e.g. i18n.set_lang('en'); Select column ->! ...
Create Operator	 ->!
(
	LEFTARG = i18n.translated_text,
	PROCEDURE = i18n.translate
);

-- Combine (concatenate) two translated text values
-- e.g. Update table Set column = column || i18n.translation_pair('en', 'Ahoy!') ...
Create Operator ||
(
	LEFTARG = i18n.translated_text,
	RIGHTARG = i18n.translated_text,
	PROCEDURE = i18n.combine
);

-- Remove a translation from a translated text value
-- e.g. Update table Set column = column - 'en' ...
Create Operator -
(
	LEFTARG = i18n.translated_text,
	RIGHTARG = text,
	PROCEDURE = i18n.delete
);


-- Create a single-language translated_text
-- e.g. Select ('en' ==> 'Hello') 
-- [Note: => was not used for compatibility with the 'hstore' module]
Create Operator ==>
(
	LEFTARG = text,
	RIGHTARG = text,
	PROCEDURE = i18n.translation_pair
);
