Degustabox.com

www.degustabox.com

The application working in 2 countries so far (Spain, UK), with plans for expanding to others.

During the development few nice components has been written:

Multilanguage Url Manager - allows defining the custom urls per lanugage for the same path and defining (I haven’t found any working component with a functionality I needed)

Payment integration component with ogone.com

Backup component saving the database and files backup to Google Drive (using JGoogleAPI)

Component for tinypng.com compression

Component for Zendesk.com Integration

Component for MailChimp.com integration

and some other minor things.

The app is still under development.

Very nice web!

Can you comment on how you made the multi language URL manager?

I have a similar need an could use some ideas.

Hi!

Thanks for comment. The Multilanguage Url Component is not perfect, but meets my needs, what I did is I overriden the CUrlManager and added the array with translations to it. The translations are configured in the config file this way:


'translations'=>array(

	'unsere-boxen'=>'product/list',

	'datenschutzbestimmungen'=>'static/index/page/privacy'

...

),

Then I overriden methods createUrl and parseUrl and before calling parent method I check if some translation from the translations array matches the URL. If so, I replace it, if not I just continue.

It’s the basic scenario, I added also the patterns for the parametrized urls, so it for example can override:


/product/list/year/2013

to


/producto/ano-2013

This works the same as the translations, but I have two arrays of regex patterns - one for creating the URLs second for parsing the urls.

For now I use one config per language, so it’s simple, but if you want to use one config for all languages, you can extend the arrays to be 3 dimensional with the language on the first dimension.

Thanks for the explanation. I had a quick look at the CUrlManager and overriding the createUrl and parseUrl methods seems doable.

So for the parseUrl you first check and process the static translations. Then, if no match, you also check for a regex match for paramterized URLs, and finally pass the result to the inherited method. [size=2]Is that how it works?[/size]

yes, exactly, the only "hack" was setting the _pathInfo i the end of parseUrl() method. I had to use reflection to set it.