Closed (duplicate)
Project:
Date
Version:
4.7.x-1.0
Component:
Miscellaneous
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
22 Dec 2006 at 17:44 UTC
Updated:
15 Feb 2007 at 10:07 UTC
Hi,
I installed the Date module, and added a Table View which shows the fields of a CCK content type, including a date.
However, the weekdays and months keep getting displayed in the English locale, even though Drupal is set to be in Dutch. The date info shown when posting a page or something, is correctly displayed in the locale, but the dates are still in english.
What can i do to solve this?
Comments
Comment #1
dodorama commentedAt the moment dropdown boxes and outputted string aren't translated.
Dropdown boxes strings are avaiable for translations but you need to create your own .po file and import it in drupal.
To translate the output strings there's a workaround at the theme level.
If you are using a tpl file to theme your fields you probably know that you have to use something like this to print the date field:
print content_format('field_date', $field_data[0], 'default'));If you're using spaces as separator for the date field (i.e '13 Nov 2006') you can explode the string and put each single value in a variable and wrap it in the t function:
If you're using slashes as separator try this:
Then you can print each part of the date wherever you want in the tpl this way:
print $calendarmonthprint $calendardayprint $calendarnumberComment #2
svendecabooterOkay thanks i got that working.
But how would i translate datestrings that get displayed in a table view. I don't have a template available for those. How can i translate a date when it's a tablefield?
Comment #3
dodorama commentedThis is how I do it.
1. Make a list view instead of a table view.
2. Run the theme_wizard and follow the instructions. You will have to copy a chunk of code in your template.php file and create a views-list-VIEWNAME.tpl.php file
3. the template.php code file looks like this (VIEWNAME is your viewname ;) ):
4. change the last part of the code like this(Again capitols words must be substituted)(at the end of the code where we are adding the tables element don't forget to insert header cells ('td') for each fields (i.e if you have 5 fields you have to insert 5 headers):
6. don't forget to apply the code snippet I posted above to correctly translate the date field
7. It looks more complex than it is but if you have basic knowledge of theming you should be able to have it working.
8. For sure there's a way to do it by theming the table view but I prefer to use the list view (for outputting tables, too) since the view wizard makes things easier and I have more control on it.
Comment #4
ray007 commentedThis issue still holds for current drupal 5 releases.
Is there an intention to fix this?
Comment #5
dodorama commentedduplicate of http://drupal.org/node/93525