At work, I’m responsible for some projects which are optimized for Google Adwords and in particular for location-based search terms.
For example, you’re searching Google for
pet shelter in Zurich. You would click on the ad of our imaginary pet shelter website and the term
zh would be passed to the website.
Now we would like to adapt images and texts on the page to your search term. Sounds easy right? Well, the easy part is to change images based on the location string. But it it’s much more complicated when you're dealing with text in 2 to 3 languages.
firstname.lastname@example.org is the first step to manage this behaviour in a single package.
Version 1.0 is currently a nice abstracted API to search through arrays. Here’s a simple example:
Get the Canton by its abbreviation
$cantonManager = new Wnx\SwissCantons\CantonManager(); $canton = $cantonManager->getByAppreviation('GR'); echo $canton->setLanguage('de')->getName(); // Graubünden
Get the Canton by it’s official name in one of four languages
$cantonManager = new Wnx\SwissCantons\CantonManager(); $canton = $cantonManager->getByName('Graubünden'); echo $canton->getAbbreviation(); // GR
The next version will include more language-based information like the different cases a Canton can be used aka „Der Kasus“. I’m not sure how I could structure this information, but I hope I can release an updated version in the upcoming weeks/months.
You find more information about the package on Github.