Hi everyone,
I have a site that has to be 100% bilingual, in English and Welsh: http://www.eryri-npa.gov.uk/
I'm just working on an asset list for news pages, that outputs the name of the page and the date it was published: http://www.eryri-npa.gov.uk/park-authority/newsroom
But for the Welsh version, we need to have the month names written in Welsh, so 29 June 2012 -> 29 Mehefin 2012.
What's the best way to do this?
I currently have the date like this:
%asset_published_j% %asset_published_F% %asset_published_Y%
The only thing I can think of is to use keyword modifiers, something like: %asset_published_F^contains:June:Mehefin%
If I do that, what's the neatest way of combining those modifiers to replace all 12 months?
Thanks,
Charlie.
[quote]
If I do that, what's the neatest way of combining those modifiers to replace all 12 months?
[/quote]
I don't think that information is contextable in Matrix, otherwise that would be the simplest solution.
I can think of a possible alternative using Matrix implementation; you could create a Matrix JS REST asset, point it to your asset listing and do some simple regular expression replacements of the month names with their alternatives. This would allow you to do all the replacements server side. You could also do similar replacements with client side javascript, but that isn't quite as tidy as the server side stuff. We've done this sort of thing before but it does require that the REST asset (Matrix) is able to make a dynamic call to an internal URL which isn't possible on all server or permission setups.
I got told off (quite rightly) at the Squiz European User Conference for not updating this thread with my solution, so here it is.
I decided to try some combined keyword modifiers… and it worked fantastically!
So for the English I just use: %asset_published_F%
For the Welsh, I use this little beauty:
%asset_published_F^replace:January:Ionawr^replace:February:Chwefror^replace:March:Mawrth^replace:April:Ebrill^replace:May:Mai^replace:June:Mehefin^replace:July:Gorffennaf^replace:August:Awst^replace:September:Medi^replace:October:Hydref^replace:November:Tachwedd^replace:December:Rhagfyr%
So, hopefully we've all learned a few things:
1 - Keyword modifiers are amazing, especially when you combine them
2 - Always come back to your support thread and update it with your solution
3 - We are currently in Gorffennaf and none of us know how to pronouce it
Charlie ;o)