Received: from localhost (unknown [200.46.204.183]) by developer.postgresql.org (Postfix) with ESMTP id 0B7802E0092 for ; Wed, 14 May 2008 12:53:32 -0300 (ADT) Received: from developer.postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 55728-01-5 for ; Wed, 14 May 2008 12:53:10 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from vilnius.balt.net (vilnius.balt.net [195.14.170.14]) by developer.postgresql.org (Postfix) with ESMTP id C416A2E007C for ; Wed, 14 May 2008 12:48:49 -0300 (ADT) Received: from nSoft.lt (unknown [217.117.29.29]) by vilnius.balt.net (Postfix) with ESMTP id CA4B53998BC; Wed, 14 May 2008 18:48:46 +0300 (EEST) Received: from [192.168.16.191] (unknown [192.168.16.191]) by nSoft.lt (Postfix) with ESMTP id 7A320BF2FE; Wed, 14 May 2008 19:29:58 +0000 (GMT) Message-ID: <482B09DE.1040601@nsoft.lt> Date: Wed, 14 May 2008 18:48:46 +0300 From: Julius Tuskenis User-Agent: Thunderbird 2.0.0.14 (Windows/20080421) MIME-Version: 1.0 To: Alvaro Herrera CC: pgsql-admin@postgresql.org Subject: Re: translating exception messages of postgresql functions References: <482AF7F7.5090309@nsoft.lt> <20080514144627.GD5521@alvh.no-ip.org> <482B03B0.8060206@nsoft.lt> <20080514153337.GI5521@alvh.no-ip.org> In-Reply-To: <20080514153337.GI5521@alvh.no-ip.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.183 tagged_above=0 required=5 tests=AWL=0.183 X-Spam-Level: X-Archive-Number: 200805/121 X-Sequence-Number: 29205 Alvaro Herrera rašė: > Julius Tuskenis wrote: > > >> I want to translate the exception message. For example I raise an >> exception in pg function like RAISE EXCEPTION 'my exception', then in my >> application that calls the function I catch the exception. But before I >> show it to the user of application I have to translate it. How do I know >> what exception it is? As Tom Lane answered - the only way is to rely on >> message text. >> > > You want to translate it from english to another language, or you want > to change the nature of the message reported? If you just want to > translate it to another language, see here: > > http://pgtranslation.projects.postgresql.org/status.html > > Thank you, Alvaro, but it seems you have slightly misunderstood me. I want to translate the exceptions I rise myself. That is I do RAISE EXCEPT 'user "%" not found', prm_user; in pl/pgsql function, but I want the user to see it translated to the language he uses. Using whole error message is inconvenient because the application gets 'user "Peter" not found' or 'user "John" not found' - not 'user "%" not found'. Thats where the problem is. -- Julius Tuskenis Programavimo skyriaus vadovas UAB nSoft mob. +37068233050