11002 Posts in 2734 Topics by 1823 members
|Go to End||Next >|
11 April 2009 at 2:49am
I tried the new version you mentioned.
I can publish the new calender successfully to my site, but when clicking the link in the navigation label I get:
FATAL ERROR: i18n::include_by_class: Class Calendar.ss.Calendar not found
At line 1259 in C:\xampp\htdocs\sapphire\core\i18n.php
user_error(i18n::include_by_class: Class Calendar.ss.Calendar not found,512)
line 1259 of i18n.php
line 132 of Core.php
_t(Calendar.ss.Calendar.BROWSECALENDAR,Browse the Calendar)
line 14 of .cacheC..xampp.htdocs.event_calendar.templates.Layout.Calendar.ss
line 197 of SSViewer.php
line 189 of SSViewer.php
line 296 of Controller.php
line 267 of Controller.php
line 22 of ModelAsController.php
line 104 of Director.php
line 158 of main.php
Debug (Debug::showError() in line 180 of Debug.php)
* class =
* module =
What is the reason for this error? Are you confident of solving this problem within a short period of time?
11 April 2009 at 5:33am
When I'm not getting the error and no one else is reporting it, it's an extremely difficult thing to troubleshoot. The last update included changes to the template, so you probably want to do a ?flush=1 to make sure you're getting those updates.
Make sure on Calendar.ss and CalendarEvent.ss that the _t() tags read something like
_t('BROWSECALENDAR','Browse the calendar')
_t('Calendar.BROWSECALENDAR','Browse the calendar')
12 April 2009 at 2:43am
Banal, do you have any thoughts on this? You seem pretty well versed in the translation functions. Did I do something wrong in the template?
13 April 2009 at 7:52am Last edited: 13 April 2009 8:11am
I had a look at your en_US.php language file. Here's what you should do:
First of all, insert global $lang; at the top (you have to do this for every language file).
The other thing to do is to insert all your translatable strings into the en_US.php file. Example:
In Calendar.php you call _t('Calendar.NUMBERFUTUREDATES','Number of future dates to show for repeating events');
You should put that as an entry in your language file, like this:
$lang['en_US']['Calendar']['NUMBERFUTUREDATES'] = 'Number of future dates to show for repeating events';
I know, this seems redundant at first because you already provide the English text in the Calendar.php. The text in the class is only meant as a fallback though and will not be used if a key with this name is available in the language file (entry in language file overrides the text you put in your class).
Doing so will also expose all your translatable strings in one file and makes it very easy to translate (just take the en_US.php file and translate all the entries in there).
When it comes to templates, there are two possibilites:
You could use the exact same syntax as in your class:
<% _t('Calendar.SUBSCRIBE','Subscribe to the Calendar') %>
OR, you use the form you are using now:
<% _t('SUBSCRIBE','Subscribe to the Calendar') %>
But this requires you to have the following entry in your lang file:
$lang['en_US']['Calendar.ss']['SUBSCRIBE'] = 'Subscribe to the Calendar';
How you organize this is up to you. Personally, I'd probably use the latter, since you can tell from the Lang file if the entry belongs to a template or to a Class.
For further "inspiration", have a look at the lang files in the SilverStripe cms folder.
13 April 2009 at 3:37pm
Thanks, Banal. That's a great explanation. Sad to see that it creates a lot of work for me, though.
Is there any way I can test this? It's strange that Marco_D is getting errors, but I don't. Should I try setting my locale to "de"? I'd like to make sure the problem is fixed before I publish the change.
13 April 2009 at 8:51pm
Hi Uncle Cheese
Yes, there's quite some work involved Maybe you could a script to extract your translatable strings. I'm not aware of such a tool for SilverStripe though.
To test this, try to put the following in your sites _config.php:
I'm currently not at the computer where I could test this.. so I can't confirm the errors Marco_D is getting.
14 April 2009 at 3:33am
I just tested this and I'm not getting the errors Marco_D reported.
The fallback of the translations works fine.. To make this whole thing translatable however, the steps mentioned previously are still imperative.
Maybe Marco_D is trying to create a multilingual site, which won't work in SilverStripe 2.3.0 and 2.3.1 for now (should be fixed in 2.3.2).
@UncleCheese: If you can complete the en_US.php file, I'll provide a German translation.
14 April 2009 at 3:40am
thanks for your great help
Currently I have some technical problems with my notebook. Therefore I am not able for instance to download and test new versions of the Event Calender module.
I will give report at the end of the week.
|Go to Top||Next >|