Ubiquity
2.5.2
php rapid development framework
Loading...
Searching...
No Matches
AbstractImportation.php
Go to the documentation of this file.
1
<?php
2
namespace
Ubiquity\translation\import
;
3
4
use
Ubiquity\translation\MessagesUpdates
;
5
use
Ubiquity\translation\MessagesDomain
;
6
use
Ubiquity\translation\TranslatorManager
;
7
8
abstract
class
AbstractImportation
{
9
10
protected
$file
;
11
12
public
function
__construct
(
$file
) {
13
$this->file =
$file
;
14
}
15
19
public
abstract
function
load
();
20
21
public
function
import
($locale, $domain) {
22
$msgDomain =
new
MessagesDomain
($locale, TranslatorManager::getLoader(), $domain);
23
$msgDomain->load();
24
$messages = $msgDomain->getMessages();
25
$messagesUpdates =
new
MessagesUpdates
($locale, $domain);
26
$messagesUpdates->load();
27
$messages = $messagesUpdates->mergeMessages($messages);
28
$newMessages = $this->
load
();
29
foreach
($newMessages as $k => $msg) {
30
if
(! isset($messages[$k])) {
31
$messagesUpdates->addValue($k, $msg, uniqid(
'key'
));
32
}
else
{
33
$messagesUpdates->updateValue($k, $msg);
34
}
35
}
36
$messagesUpdates->save();
37
}
38
}
39
Ubiquity\translation\MessagesDomain
Represents a list of messages in a domain for a locale.
Definition
MessagesDomain.php:16
Ubiquity\translation\MessagesUpdates
Store translation updates.
Definition
MessagesUpdates.php:17
Ubiquity\translation\TranslatorManager
Manage translations.
Definition
TranslatorManager.php:20
Ubiquity\translation\import\AbstractImportation
Definition
AbstractImportation.php:8
Ubiquity\translation\import\AbstractImportation\load
load()
return array
Ubiquity\translation\import\AbstractImportation\__construct
__construct($file)
Definition
AbstractImportation.php:12
Ubiquity\translation\import\AbstractImportation\$file
$file
Definition
AbstractImportation.php:10
Ubiquity\translation\import
Definition
AbstractImportation.php:2
C:
Users
myadd
Documents
GitHub
ubiquity-doc-api
vendor
phpmv
ubiquity
src
Ubiquity
translation
import
AbstractImportation.php
Generated on Sun Dec 10 2023 15:04:25 for
Ubiquity
by
doxygen
1.9.8