<?php

/**
 * Translation service with file backend
 *
 * @version 1.5
 */
class i18nFileTranslationService extends i18nTranslationService {



	protected function load(ArrayObject $list) {
		$langs = array_keys($this->cache);
		foreach ($langs as $lang) {
			$langFile = "i18n/$lang";
			if (!file_exists($langFile)) {
				continue;
			}
			$f = file($langFile);
			foreach ($f as $ln) {
				if (strpos($ln, '=') !== false) {
					list($orig, $trans) = explode('=', $ln);
					$orig = trim($orig);
					foreach ($list as $i => $item) {
						if ($item[1] == $lang and $item[0] == $orig) {
							$this->setTranslation($orig, $lang, trim($trans));
						}
					}
				}
			}
		}
	}



} // class i18nFileTranslationService

?>