>> Just create an empty mo file for 'nl'... a task of 30 seconds.
>> This is how things work with all gettext variants. 

Now I finally understand  :-)
But didn't know this trick, I have no experience at all with gettext
Thank you !!   :-)



Thomas Weidner-2 wrote:
> 
> Just create an empty mo file for 'nl'... a task of 30 seconds.
> This is how things work with all gettext variants.
> 
> The point is, that most people use real strings as messageid because this 
> makes the code more readable.
> But they are still no "own" language and that's why an exception is
> raised.
> You can referr to it as "machinecode" or "messageid" as we have named it.
> 
> As you may have seen we do not provide informations for how to create the 
> translation files.
> This is because the documentation was written for people who are already 
> familiar with gettext or the other formats.
> And in the manual you see that the default language is selected and the 
> other language is added...
> 
> We do never try to set an other language as default.
> If you would just try to translate it it would work...
> 
> $translate = new Zend_Translate('myfile.mo', 'fr');
> $translate->_('I want this text', 'nl');
> // prints "I want this text" and throws NO exception
> 
> And this is because "while translation never an exception occurs"...
> that's 
> what is written in the docu.
> 
> Again:
> You can not set an default to an language which does not exist...
> BUT you can try to translate a not defined language and will get the 
> messageid returned.
> 
> Greetings
> Thomas
> I18N Team Leader
> 
> ----- Original Message ----- 
> From: "debussy007" <[EMAIL PROTECTED]>
> To: <[email protected]>
> Sent: Thursday, January 10, 2008 5:07 PM
> Subject: Re: [fw-general] Zend_Translate exception
> 
> 
>>
>> The manual is then confusing,
>> because the strings inside the translate function do not look like
>> message
>> id's, but rather like the untranslated text.
>> e.g. from the manual:
>>>> print $translate->_("Here is line one")."\n";
>>>> printf($translate->_("Today is the %1\$s") . "\n", date("d.m.Y"));
>>
>> That's why I tought that if a language in the local has no file
>> associated
>> to it, use the untranslated text inside the translate function.
>>
>> I didn't specify nl because the string inside the translate function are
>> already dutch (untranslated text). So I would have a .mo file from dutch 
>> to
>> dutch.
>>
>> If I'm not wrong, the manual is confusing.
>> Sorry if I misunderstood again.
>>
>>
>>
>>
>> Thomas Weidner-2 wrote:
>>>
>>> What do you mean with "already use english"...
>>>
>>> You are defining MessageIDs... these are textstrings... and if you want 
>>> to
>>> output a messageid you have to provide a translation.
>>> You can not do a translation and then expect the messageid to get 
>>> returned
>>> .
>>> The system does not know if your string "EDIT_3" or "Edit" is a real
>>> string
>>> or a messageid.
>>>
>>> There is a own function for getting the messageid and you can only use
>>> languages which you have defined.
>>>
>>> The point is that you have not defined 'nl' to be part of
>>> Zend_Translate,
>>> only 'fr' and 'en', and therefor you get the exception that you have not
>>> defined 'nl' as language.
>>>
>>> So, define 'nl' as language and then you can set it as standard with
>>> setLocale().
>>>
>>>
>>> ----- Original Message ----- 
>>> From: "debussy007" <[EMAIL PROTECTED]>
>>> To: <[email protected]>
>>> Sent: Thursday, January 10, 2008 3:55 PM
>>> Subject: Re: [fw-general] Zend_Translate exception
>>>
>>>
>>>>
>>>> Let's say I use english in my pages,
>>>> I will have to have an english translation of english ??
>>>>
>>>> The problem is if I set the locale to "en" english, it will throw me 
>>>> that
>>>> exception because I do not want to provide a translation from english
>>>> to
>>>> english. That's why I have no file for "en" in this case and it throws 
>>>> me
>>>> an
>>>> exception.
>>>>
>>>>
>>>>
>>>> Thomas Weidner-2 wrote:
>>>>>
>>>>> Hy,
>>>>>
>>>>> you missunderstood something...
>>>>>
>>>>> Expect the following:
>>>>> You have english as standard language and used as messageids.
>>>>> You have german and english translations.....
>>>>> Now one of your messageid is not translated in german so the original
>>>>> english will be returned instead of throwing an exception.
>>>>>
>>>>> BUT:
>>>>> If you set an language which Zend_Locale does not know it throws you
>>>>> an
>>>>> exception.
>>>>>
>>>>> Reading through the returned message you see:
>>>>>
>>>>>> Uncaught exception 'Zend_Translate_Exception' with message 'Language
>>>>>> (nl)
>>>>>> has to be added before it can be used.
>>>>>
>>>>> So what you will have to do before you can use a language is
>>>>> $translate->addLanguage('myfile.mo', 'nl');
>>>>>
>>>>> If something is not translated within a file... no problem...
>>>>> But if there is no file we have no way to do anything but throw an
>>>>> exception
>>>>> :-)
>>>>>
>>>>> Greetings
>>>>> Thomas
>>>>> I18N Team Leader
>>>>>
>>>>> ----- Original Message ----- 
>>>>> From: "debussy007" <[EMAIL PROTECTED]>
>>>>> To: <[email protected]>
>>>>> Sent: Thursday, January 10, 2008 12:46 PM
>>>>> Subject: [fw-general] Zend_Translate exception
>>>>>
>>>>>
>>>>>>
>>>>>> Hi,
>>>>>>
>>>>>> I am using Zend_Translate to internationalize my application.
>>>>>>
>>>>>> $translate = new Zend_Translate('gettext',
>>>>>> './public/ress/source-fr.mo',
>>>>>> 'fr');
>>>>>> $translate->addTranslation('./public/ress/source-en.mo', 'en');
>>>>>> $translate->setLocale("nl");
>>>>>> Zend_Registry::set(Constants::REG_TRANSLATE, $translate);
>>>>>>
>>>>>> The text is translated well if I set the local "fr" or "en" and it
>>>>>> output
>>>>>> the string from the appropriate .mo file.
>>>>>> But once that I set it to "nl", I have the following exception:
>>>>>>
>>>>>> Uncaught exception 'Zend_Translate_Exception' with message 'Language
>>>>>> (nl)
>>>>>> has to be added before it can be used.
>>>>>>
>>>>>> But I was excepting to have the untranslated string back ! Because in
>>>>>> the
>>>>>> manual it says that if no translation is found for "nl", the original
>>>>>> message is returned.
>>>>>>
>>>>>> Thank you for any help !
>>>>>> -- 
>>>>>> View this message in context:
>>>>>> http://www.nabble.com/Zend_Translate-exception-tp14731178s16154p14731178.html
>>>>>> Sent from the Zend Framework mailing list archive at Nabble.com.
>>>>>
>>>>>
>>>>>
>>>>
>>>> -- 
>>>> View this message in context:
>>>> http://www.nabble.com/Zend_Translate-exception-tp14731178s16154p14735844.html
>>>> Sent from the Zend Framework mailing list archive at Nabble.com.
>>>
>>>
>>>
>>
>> -- 
>> View this message in context: 
>> http://www.nabble.com/Zend_Translate-exception-tp14731178s16154p14737016.html
>> Sent from the Zend Framework mailing list archive at Nabble.com. 
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Zend_Translate-exception-tp14731178s16154p14741151.html
Sent from the Zend Framework mailing list archive at Nabble.com.

Reply via email to