eymengunay / php-passbook

iOS passbook library for PHP
http://eymengunay.github.io/php-passbook/
MIT License
263 stars 53 forks source link

Pass localization #26

Closed Zorato closed 9 years ago

Zorato commented 10 years ago

Hi! Are there any plans for adding pass localization support? Apple reference: https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/PassKit_PG/Chapters/Creating.html#//apple_ref/doc/uid/TP40012195-CH4-SW54

swey commented 9 years ago

Hi @Zorato,

I extended the lib and added support for localization. At the moment you can only get it in my fork's branch "feature/localization". It's basically tested. After some more testing I will merge it to master. https://github.com/swey/php-passbook/tree/feature/localization

If you use composer, you will need this config:

    "repositories": [
      {
        "type": "vcs",
        "url": "https://github.com/swey/php-passbook/"
      }
    ],
    "require": {
        "eo/passbook": "dev-feature/localization"
    },

Usage:

        // ...
        $primary = new Field('event', 'event_name');
        $primary->setLabel('event_label');
        $structure->addPrimaryField($primary);
        // ...

        $localization = new Localization('de');
        $localization->addImage(  new Image('./public/logo-de.png', 'logo') );
        $localization->addStrings(array(
            'event_name'    => 'Deutscher Name'
        ));
        $pass->addLocalization( $localization );

        $localization = new Localization('en');
        $localization->addImage(  new Image('../public/logo-en.png', 'logo') );
        $localization->addStrings(array(
            'event_name'    => 'English name',
        ));
        $pass->addLocalization( $localization );

I hope @eymengunay will adopt my changes or make me a collaborator. Then I can push my feature branch directly to this repository.

Zorato commented 9 years ago

Hi, @swey. Thanks for your work. I have extended @eymengunay library to fit my needs, but your code is more flexible and supports image localization. Hope it will be merged in eymengunay/php-passbook master branch.

g- commented 9 years ago

This has been merged in.

g- commented 9 years ago

Released in Version 1.2.0.