1 | <?php |
||
15 | class Translatable |
||
16 | { |
||
17 | /** |
||
18 | * @var string $id |
||
19 | */ |
||
20 | protected $id; |
||
21 | |||
22 | /** |
||
23 | * @var string $domain |
||
24 | */ |
||
25 | protected $domain; |
||
26 | |||
27 | /** |
||
28 | * @var string $locale |
||
29 | */ |
||
30 | protected $locale; |
||
31 | |||
32 | /** |
||
33 | * @var string $original |
||
34 | */ |
||
35 | protected $original; |
||
36 | |||
37 | /** |
||
38 | * @var string $translated |
||
39 | */ |
||
40 | protected $translated; |
||
41 | |||
42 | /** |
||
43 | * @var boolean $isLocalized |
||
44 | */ |
||
45 | protected $isLocalized; |
||
46 | |||
47 | /** |
||
48 | * set id, converted to sha1 40 chars if not xdigit |
||
49 | * |
||
50 | * @param string $id id |
||
51 | * |
||
52 | * @return void |
||
53 | */ |
||
54 | public function setId($id) |
||
55 | { |
||
56 | $this->id = ctype_xdigit($id) ? $id : sha1($id); |
||
57 | } |
||
58 | |||
59 | /** |
||
60 | * get id |
||
61 | * |
||
62 | * @return string |
||
63 | */ |
||
64 | public function getId() |
||
68 | |||
69 | /** |
||
70 | * set domain |
||
71 | * |
||
72 | * @param string $domain domain |
||
73 | * |
||
74 | * @return void |
||
75 | */ |
||
76 | public function setDomain($domain) |
||
77 | { |
||
78 | $this->domain = $domain; |
||
79 | } |
||
80 | |||
81 | /** |
||
82 | * get domain |
||
83 | * |
||
84 | * @return string |
||
85 | */ |
||
86 | public function getDomain() |
||
90 | |||
91 | /** |
||
92 | * set locale |
||
93 | * |
||
94 | * @param string $locale locale |
||
95 | * |
||
96 | * @return void |
||
97 | */ |
||
98 | public function setLocale($locale) |
||
99 | { |
||
100 | $this->locale = $locale; |
||
101 | } |
||
102 | |||
103 | /** |
||
104 | * get locale |
||
105 | * |
||
106 | * @return string |
||
107 | */ |
||
108 | public function getLocale() |
||
112 | |||
113 | /** |
||
114 | * get original |
||
115 | * |
||
116 | * @param string $original original string |
||
117 | * |
||
118 | * @return void |
||
119 | */ |
||
120 | public function setOriginal($original) |
||
121 | { |
||
122 | $this->original = $original; |
||
123 | } |
||
124 | |||
125 | /** |
||
126 | * get original |
||
127 | * |
||
128 | * @return string |
||
129 | */ |
||
130 | public function getOriginal() |
||
134 | |||
135 | /** |
||
136 | * set translated |
||
137 | * |
||
138 | * @param string $translated translated string |
||
139 | * |
||
140 | * @return void |
||
141 | */ |
||
142 | public function setTranslated($translated) |
||
146 | |||
147 | /** |
||
148 | * get translated string |
||
149 | * |
||
150 | * @return string |
||
151 | */ |
||
152 | public function getTranslated() |
||
156 | |||
157 | /** |
||
158 | * set isLocalized |
||
159 | * |
||
160 | * @param boolean $isLocalized true/false |
||
161 | * |
||
162 | * @return void |
||
163 | */ |
||
164 | public function setIsLocalized($isLocalized) |
||
168 | |||
169 | /** |
||
170 | * is this document localized |
||
171 | * |
||
172 | * @return boolean |
||
173 | */ |
||
174 | public function isLocalized() |
||
178 | |||
179 | /** |
||
180 | * @var string $language url |
||
181 | */ |
||
182 | protected $language; |
||
183 | |||
184 | /** |
||
185 | * Set language |
||
186 | * |
||
187 | * @param string $language url |
||
188 | * @return self |
||
189 | */ |
||
190 | public function setLanguage($language) |
||
195 | |||
196 | /** |
||
197 | * Get language |
||
198 | * |
||
199 | * @return string $language |
||
200 | */ |
||
201 | public function getLanguage() |
||
205 | } |
||
206 |