arteq/lift

0.1.2 2019-07-31 09:31 UTC

This package is auto-updated.

Last update: 2024-05-29 04:15:59 UTC


README

Biblioteka umożliwia wygenerowanie uproszczonego słownika w formacie LIFT (XML).

Instalacja

$ composer require arteq/lift

Opcjonalnie można przeprowadzić testy:

$ vendor/bin/phpunit

Tworzenie słownika

<?php 

use ArteQ\LIFT\Dictionary;
use ArteQ\LIFT\Term;
use ArteQ\LIFT\Translation;

require __DIR__.'/../vendor/autoload.php';

// create dictionary
$dict = new Dictionary();

// create first english term, with autogenerated id
$term = new Term('word', 'en');

// create translation
$translation = new Translation('słowo', 'pl');
$translation->addNote('Dodatkowa notatka');
$translation->addDefinition('Definicja encyklopedyczna');
$translation->addExample('Przykład użycia', 'de');

// add translation to term
$term->addTranslation($translation);

// add term to dictionary
$dict->addTerm($term);

// generate XML & display
$xml = $dict->generate();
echo $xml;

// generate XML and save to file
$dict->save('/file/path/dict.lift');

Więcej...

https://github.com/sillsdev/lift-standard