This is a picture of me.

Simon Buckley


Introducing: Kirby Pig Latin Plugin

30 September 2019

It was a beautiful day here in Sydney. The sun was shining, the birds were singing, and I decided to do something horrible.

For those of you that were homeschooled, locked up in a basement, or otherwise denied basic social interaction from a young age and thus don’t already know, Pig Latin is a made up “language” used by children and “formed from English by transferring the initial consonant or consonant cluster of each word to the end of the word and adding a vocalic syllable” (thanks Google).

I decided to make a Kirby field method plugin to do this for me.

The trouble is, Pig Latin actually has a few rules and exceptions that make it complicated to implement. For example:

Well, with some low-quality PHP, an hour or two of frustration, and a healthy amount of trepidation, I’m willing to announce here that the plugin is alive.

From the Github repository:

Built with terrible PHP for Kirby 3, this gross and unsightly plugin will provide you and your visitors with about a minute of priceless amusement, followed by disappointment and frustration.

Download from Github

To install my Kirby Pig Latin plugin, download it from the Github link above, and extract the index.php file to a folder called kirby-piglatin in your site/plugins directory.

To use it in your templates, call it using the toPigLatin() function, like below:

<?= $page->fieldName()->toPigLatin(); ?>

The plugin supports chaining for further processing, though it’s only been tested in a very limited manner, and doesn’t work correctly with Kirbytags like the image tag.

<?= $page->fieldName()->toPigLatin()->kirbytext(); ?>
Below is the content of this blog post, but put through my Pig Latin plugin. I’m really sorry in advance.

Itay asway aay eautifulbay ayday erehay inay Ydneysay. Hetay unsay asway hiningsay, hetay irdsbay ereway igningsay, anday Iay ecidedday otay oday omethingsay orriblehay.

Orfay hosetay ofay ouyay hattay ereway omeschooledhay, ockedlay upay inay aay asementbay, oray otherwiseay eniedday asicbay ocialsay interactionay romfay aay oungyay ageay anday hustay on’tday alreadyay nowkay, Igpay Atinlay isay aay ademay upay “language” useday ybay hildrencay anday “formed romfay Englishay ybay ransferringtay hetay initialay onsonantcay oray onsonantcay lustercay ofay eachay ordway otay hetay enday ofay hetay ordway anday addingay aay ocalicvay yllable”say (thanks Oogle)gay.

Iay ecidedday otay akemay aay Irbykay ieldfay ethodmay luginpay otay oday histay orfay emay.

Hetay roubletay isay, Igpay Atinlay actuallyay ashay aay ewfay ulesray anday exceptionsay hattay akemay itay omplicatedcay otay implementay. Orfay example:ay

Ellway, ithway omesay ow-qualitylay Hppay, anay ourhay oray wotay ofay rustrationfay, anday aay ealthyhay amountay ofay repidationtay, I’may illingway otay announceay erehay hattay hetay luginpay isay aliveay.

Romfay hetay Ithubgay epository:ray

Uiltbay ithway erribletay Hppay orfay Irbykay 3, histay rossgay anday unsightlyay luginpay illway rovidepay ouyay anday ouryay isitorsvay ithway aboutay aay inutemay ofay ricelesspay amusementay, ollowedfay ybay isappointmentday anday rustrationfay.

Otay installay ymay Irbykay Igpay Atinlay luginpay, ownloadday itay romfay hetay Ithubgay inklay aboveay, anday extractay hetay indexphpay. ilefay otay aay olderfay alledcay kirby-piglatin inay ouryay site/plugins irectoryday.

Otay useay itay inay ouryay emplatestay, allcay itay usingay hetay topiglatin() unctionfay, ikelay elow:bay

 <=? $page->fieldname()->topiglatin(); >?

Hetay luginpay upportssay hainingcay orfay urtherfay rocessingpay, houghtay it’say onlyay eenbay estedtay inay aay eryvay imitedlay annermay, anday oesn’tday orkway orrectlycay ithway Irbytagskay ikelay hetay imageay agtay.

 <=? $page->fieldname()->topiglatin()->kirbytext(); >?
Kirby PHP Web Development Lolz

This post was last updated on 8 October 2019