You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: tools/i18n/add-textdomain.php
+64-24Lines changed: 64 additions & 24 deletions
Original file line number
Diff line number
Diff line change
@@ -17,40 +17,78 @@ class AddTextdomain {
17
17
/**
18
18
* Constructor.
19
19
*/
20
-
function__construct() {
20
+
publicfunction__construct() {
21
21
$makepot = newMakePOT;
22
22
$this->funcs = array_keys( $makepot->rules );
23
23
$this->funcs[] = 'translate_nooped_plural';
24
24
}
25
25
26
-
functionusage() {
26
+
/**
27
+
* Prints CLI usage.
28
+
*/
29
+
publicfunctionusage() {
27
30
$usage = "Usage: php add-textdomain.php [-i] <domain> <file>\n\nAdds the string <domain> as a last argument to all i18n function calls in <file>\nand prints the modified php file on standard output.\n\nOptions:\n -i Modifies the PHP file in place, instead of printing it to standard output.\n";
28
31
fwrite(STDERR, $usage);
29
32
exit(1);
30
33
}
31
34
32
-
functionprocess_token($token_text, $inplace) {
33
-
if ($inplace)
34
-
$this->modified_contents .= $token_text;
35
-
else
36
-
echo$token_text;
35
+
/**
36
+
* Adds textdomain to a single file.
37
+
*
38
+
* @see AddTextdomain::process_string()
39
+
*
40
+
* @param string $domain Text domain.
41
+
* @param string $source_filename Filename with optional path.
42
+
* @param bool $inplace True to modifies the PHP file in place. False to print to standard output.
0 commit comments