| | 2 | |
| | 3 | == Jak skonfigurować == |
| | 4 | Do katalogu rozszerzen php np. ''C:/ProgramFiles/PHP/ext'' kopiujemy skompilowany moduł pobrany z załączników poniżej - jest to plik php_bsedt.dll |
| | 5 | |
| | 6 | Dodajemy opcje do pliku konfiguracyjnego PHP ''php.ini'', |
| | 7 | {{{ |
| | 8 | extension=php_bsedt.dll |
| | 9 | |
| | 10 | [bsedt] |
| | 11 | bsedt.lang_path="C:\Program Files\BetaSoft\eDokumenty\public_html\apps\edokumenty\share\lang" |
| | 12 | bsedt.lang=en_UK |
| | 13 | |
| | 14 | }}} |
| | 15 | |
| | 16 | restartujemy apache (w konsoli httpd -k restart) i gotowe. |
| | 17 | |
| | 18 | |
| | 19 | |
| | 20 | === How to configure on Linux === |
| | 21 | Na Linux musimy pierwsze skompilować nową bibliotekę do PHP. |
| | 22 | W tym celu należy wyposażyć w system w narzędzia developerskie php oraz ściągnąć |
| | 23 | źródła z załączonego pliku. Wymagane pakiety developerskie: gcc, glibc-devel, php-devel(php5-dev dla debiana). |
| | 24 | |
| | 25 | [[BR]] |
| | 26 | PLD |
| | 27 | {{{ |
| | 28 | poldek -i php-pear-CodeGen |
| | 29 | cd /usr/include/php/ext |
| | 30 | svn co https://localhost:444/svn/repos/edokumenty/src/translator |
| | 31 | pecl-gen --extname=bsedt |
| | 32 | cp translator/* bsedt/ |
| | 33 | cd bsedt |
| | 34 | phpize |
| | 35 | ./configure |
| | 36 | make |
| | 37 | make install |
| | 38 | vim /etc/php/conf.d/bsedt.ini |
| | 39 | vim /etc/php/php.ini |
| | 40 | apachectl -f /etc/httpd/apache.conf -k restart |
| | 41 | }}} |
| | 42 | [[BR]] |
| | 43 | Debian |
| | 44 | {{{ |
| | 45 | cd /usr/include/php/ext |
| | 46 | svn co https://localhost:444/svn/repos/edokumenty/src/translator |
| | 47 | mv translator bsedt |
| | 48 | cd bsedt |
| | 49 | phpize |
| | 50 | ./configure |
| | 51 | make |
| | 52 | make install |
| | 53 | vim /etc/php5/conf.d/bsedt.ini |
| | 54 | vim /etc/php5/apache2/php.ini |
| | 55 | apache2 -k restart |
| | 56 | }}} |
| | 57 | |
| | 58 | Dla większości dystrybucji Linux konfiguracja zewnętrznego modułu jest zalecana do wprowadzenia w osobnym pliku w katalogu /etc/php5/conf.d. Zatem tworzymy plik bsedt.ini i wstawiamy tam linię powodującą załadowanie modułu. |
| | 59 | |
| | 60 | {{{ |
| | 61 | extension=php_bsedt.so |
| | 62 | }}} |
| | 63 | |
| | 64 | |
| | 65 | A w pliku php.ini tworzymy sekcję : |
| | 66 | |
| | 67 | |
| | 68 | {{{ |
| | 69 | [bsedt] |
| | 70 | bsedt.lang_path="/home/edokumenty/public_html/apps/edokumenty/share/lang" |
| | 71 | bsedt.lang=en_UK |
| | 72 | }}} |
| | 73 | |
| | 74 | |
| | 75 | == How it works == |
| | 76 | Translations are stored in .mo files in /var/lang catalogue in projects tree. |
| | 77 | These files are parsed according to configuration option ''bsedt.lang''. |
| | 78 | Access to strings are implemented by ''Transaltor::translate($string, $activelanguage)''. |
| | 79 | This is passed to PHP_MODULE ''bsedt'' that looks for these strings in files that are stored in phisical memory by apache. |
| | 80 | That solution allows to extremely fast translations, enhancing the performance of application. |