umpirsky / Transliterator

Transliterator is a PHP library for text transliteration.
http://transliterate.umpirsky.com/
MIT License
61 stars 10 forks source link

Fatal error: Call to private Transliterator::__construct() #4

Closed ttasovac closed 9 years ago

ttasovac commented 9 years ago

how should one instantiate the Transliterator? the readme says this:

$transliterator = new Transliterator(Settings::LANG_SR);

but the above gives me:

Fatal error: Call to private Transliterator::__construct() from invalid context in /var/www/abc.dev/html/methods/forms.php on line 43

any hints would be greatly appreciated.

umpirsky commented 9 years ago

Looks fine @ttasovac.

That is how I instantiate it in tests. It should work.

Can you create a test script or provide full example php file?

ttasovac commented 9 years ago

Хвала, Саша! :) The problem may be that I am not using Composer and autoloading etc. So I did this:

require_once('vendor/umpirsky/src/Transliterator/Transliterator.php');
$transliterator = new Transliterator(Settings::LANG_SR);

and I ended up with the above error.

Sorry to be a pain — I'm sure this is just me not understanding something totally basic.

umpirsky commented 9 years ago

@ttasovac Why not using compser? :)

May it be you have old or changed version of Transliterator. Is constructor private in your local copy?

ttasovac commented 9 years ago

no, i have the latest version — i really couldn't make any sense of this error. but i did manage to get the transliterator to work with this:

require_once('vendor/umpirsky/src/autoload.php');
    $transliterator = new \Transliterator\Transliterator("sr");

so no more drama from me, ok? :)

umpirsky commented 9 years ago

Oh, ok, that is the recommanded way. :)