Skip to content

Commit c28b944

Browse files
authored
Merge pull request phpbb#6635 from iMattPro/ticket/17335
[ticket/17335] Fix language var issues in the extension manager
2 parents 4010c88 + 4441375 commit c28b944

File tree

5 files changed

+88
-49
lines changed

5 files changed

+88
-49
lines changed

phpBB/adm/style/acp_ext_list.html

Lines changed: 38 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -99,25 +99,44 @@ <h1>{L_EXTENSIONS_ADMIN}</h1>
9999
</table>
100100

101101
<table class="table1">
102-
<tr>
103-
<th>{L_EXTENSION_INSTALL_HEADLINE}</th>
104-
</tr>
105-
<tr>
106-
<td class="row3">{L_EXTENSION_INSTALL_EXPLAIN}</td>
107-
</tr>
108-
<tr>
109-
<th>{L_EXTENSION_UPDATE_HEADLINE}</th>
110-
</tr>
111-
<tr>
112-
<td class="row3">{L_EXTENSION_UPDATE_EXPLAIN}</td>
113-
</tr>
114-
<tr>
115-
<th>{L_EXTENSION_REMOVE_HEADLINE}</th>
116-
</tr>
117-
<tr>
118-
<td class="row3">{L_EXTENSION_REMOVE_EXPLAIN}</td>
119-
</tr>
120-
</tbody>
102+
<tbody>
103+
<tr>
104+
<th>{L_EXTENSION_INSTALLING_HEADLINE}</th>
105+
</tr>
106+
<tr>
107+
<td class="row3">
108+
<ol>
109+
{% for step in lang_raw('EXTENSION_INSTALLING_EXPLAIN') %}
110+
<li>{{ step }}</li>
111+
{% endfor %}
112+
</ol>
113+
</td>
114+
</tr>
115+
<tr>
116+
<th>{L_EXTENSION_UPDATING_HEADLINE}</th>
117+
</tr>
118+
<tr>
119+
<td class="row3">
120+
<ol>
121+
{% for step in lang_raw('EXTENSION_UPDATING_EXPLAIN') %}
122+
<li>{{ step }}</li>
123+
{% endfor %}
124+
</ol>
125+
</td>
126+
</tr>
127+
<tr>
128+
<th>{L_EXTENSION_REMOVING_HEADLINE}</th>
129+
</tr>
130+
<tr>
131+
<td class="row3">
132+
<ol>
133+
{% for step in lang_raw('EXTENSION_REMOVING_EXPLAIN') %}
134+
<li>{{ step }}</li>
135+
{% endfor %}
136+
</ol>
137+
</td>
138+
</tr>
139+
</tbody>
121140
</table>
122141

123142
<!-- INCLUDE overall_footer.html -->

phpBB/language/en/acp/extensions.php

Lines changed: 30 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -36,14 +36,15 @@
3636

3737
$lang = array_merge($lang, array(
3838

39-
'EXTENSION_ALREADY_INSTALLED' => 'The “%s” extension has already been installed.',
40-
'EXTENSION_ALREADY_INSTALLED_MANUALLY' => 'The “%s” extension has already been installed manually.',
41-
'EXTENSION_ALREADY_MANAGED' => 'The “%s” extension is already managed.',
42-
'EXTENSION_CANNOT_MANAGE_FILESYSTEM_ERROR' => 'The “%s” extension cannot be managed because the existing files could not be removed from the filesystem.',
43-
'EXTENSION_CANNOT_MANAGE_INSTALL_ERROR' => 'The “%s” extension could not be installed. The prior installation of this extension has been restored.',
44-
'EXTENSION_MANAGED_WITH_CLEAN_ERROR' => 'The “%1$s” extension has been installed but an error occurred and the old files could not be removed. You might want to delete the “%2$s” files manually.',
45-
'EXTENSION_MANAGED_WITH_ENABLE_ERROR' => 'The “%s” extension has been installed but an error occurred while enabling it.',
46-
'EXTENSION_NOT_INSTALLED' => 'The “%s” extension is not installed.',
39+
'EXTENSIONS_ALREADY_INSTALLED' => 'The “%s” extension has already been installed.',
40+
'EXTENSIONS_ALREADY_INSTALLED_MANUALLY' => 'The “%s” extension has already been installed manually.',
41+
'EXTENSIONS_ALREADY_MANAGED' => 'The “%s” extension is already managed.',
42+
'EXTENSIONS_CANNOT_MANAGE_FILESYSTEM_ERROR' => 'The “%s” extension cannot be managed because the existing files could not be removed from the filesystem.',
43+
'EXTENSIONS_CANNOT_MANAGE_INSTALL_ERROR' => 'The “%s” extension could not be installed. The prior installation of this extension has been restored.',
44+
'EXTENSIONS_MANAGED_WITH_CLEAN_ERROR' => 'The “%1$s” extension has been installed but an error occurred and the old files could not be removed. You might want to delete the “%2$s” files manually.',
45+
'EXTENSIONS_MANAGED_WITH_ENABLE_ERROR' => 'The “%s” extension has been installed but an error occurred while enabling it.',
46+
'EXTENSIONS_NOT_INSTALLED' => 'The “%s” extension is not installed.',
47+
'EXTENSIONS_NOT_MANAGED' => 'The “%s” extension is not being managed.',
4748

4849
'ENABLING_EXTENSIONS' => 'Enabling extensions',
4950
'DISABLING_EXTENSIONS' => 'Disabling extensions',
@@ -74,6 +75,8 @@
7475
'EXTENSION_DELETE_DATA_EXPLAIN' => 'Deleting an extension’s data removes all of its data and settings. The extension files are retained so it can be enabled again.',
7576
'EXTENSION_DISABLE_EXPLAIN' => 'Disabling an extension retains its files, data and settings but removes any functionality added by the extension.',
7677
'EXTENSION_ENABLE_EXPLAIN' => 'Enabling an extension allows you to use it on your board.',
78+
'EXTENSION_REMOVE_EXPLAIN' => 'Removing an extension removes all of its files, data and settings.',
79+
'EXTENSION_UPDATE_EXPLAIN' => 'Updating an extension will install the latest version compatible with your board, removing old files and replacing them with new ones, and updating the database if necessary.',
7780

7881
'EXTENSION_DELETE_DATA_IN_PROGRESS' => 'The extension’s data is currently being deleted. Please do not leave or refresh this page until it is completed.',
7982
'EXTENSION_DISABLE_IN_PROGRESS' => 'The extension is currently being disabled. Please do not leave or refresh this page until it is completed.',
@@ -86,25 +89,25 @@
8689
'EXTENSION_NAME' => 'Extension Name',
8790
'EXTENSION_ACTIONS' => 'Actions',
8891
'EXTENSION_OPTIONS' => 'Options',
89-
'EXTENSION_INSTALL_HEADLINE'=> 'Installing an extension',
90-
'EXTENSION_INSTALL_EXPLAIN' => '<ol>
91-
<li>Download an extension from phpBB’s extensions database</li>
92-
<li>Unzip the extension and upload it to the <samp>ext/</samp> directory of your phpBB board</li>
93-
<li>Enable the extension, here in the Extensions manager</li>
94-
</ol>',
95-
'EXTENSION_UPDATE_HEADLINE' => 'Updating an extension',
96-
'EXTENSION_UPDATE_EXPLAIN' => '<ol>
97-
<li>Disable the extension</li>
98-
<li>Delete the extension’s files from the filesystem</li>
99-
<li>Upload the new files</li>
100-
<li>Enable the extension</li>
101-
</ol>',
102-
'EXTENSION_REMOVE_HEADLINE' => 'Completely removing an extension from your board',
103-
'EXTENSION_REMOVE_EXPLAIN' => '<ol>
104-
<li>Disable the extension</li>
105-
<li>Delete the extension’s data</li>
106-
<li>Delete the extension’s files from the filesystem</li>
107-
</ol>',
92+
'EXTENSION_INSTALLING_HEADLINE' => 'Installing an extension',
93+
'EXTENSION_INSTALLING_EXPLAIN' => [
94+
0 => 'Download an extension from phpBB’s extensions database',
95+
1 => 'Unzip the extension and upload it to the <samp>ext/</samp> directory of your phpBB board',
96+
2 => 'Enable the extension, here in the Extensions manager',
97+
],
98+
'EXTENSION_REMOVING_HEADLINE' => 'Deleting an extension from your board',
99+
'EXTENSION_REMOVING_EXPLAIN' => [
100+
0 => 'Disable the extension',
101+
1 => 'Delete the extension’s data',
102+
2 => 'Delete the extension‘s files from the filesystem',
103+
],
104+
'EXTENSION_UPDATING_HEADLINE' => 'Updating an extension',
105+
'EXTENSION_UPDATING_EXPLAIN' => [
106+
0 => 'Disable the extension',
107+
1 => 'Delete the extension’s files from the filesystem',
108+
2 => 'Upload the new files',
109+
3 => 'Enable the extension',
110+
],
108111

109112
'EXTENSION_DELETE_DATA_CONFIRM' => 'Are you sure that you wish to delete the data associated with “%s”?<br /><br />This removes all of its data and settings and cannot be undone!',
110113
'EXTENSION_DISABLE_CONFIRM' => 'Are you sure that you wish to disable the “%s” extension?',

phpBB/phpbb/template/twig/extension.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ public function getFunctions()
9393
new \Twig\TwigFunction('lang', array($this, 'lang')),
9494
new \Twig\TwigFunction('lang_defined', array($this, 'lang_defined')),
9595
new \Twig\TwigFunction('lang_js', [$this, 'lang_js']),
96+
new \Twig\TwigFunction('lang_raw', [$this, 'lang_raw']),
9697
new \Twig\TwigFunction('get_class', 'get_class'),
9798
);
9899
}
@@ -214,4 +215,16 @@ public function lang_js(): string
214215

215216
return twig_escape_filter($this->environment, call_user_func_array([$this, 'lang'], $args), 'js');
216217
}
218+
219+
/**
220+
* Get raw value associated with lang key
221+
*
222+
* @param string $key
223+
*
224+
* @return array|string Raw value associated with lang key
225+
*/
226+
public function lang_raw(string $key): array|string
227+
{
228+
return call_user_func_array(array($this->language, 'lang_raw'), [$key]);
229+
}
217230
}

tests/template/template_test.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -365,15 +365,15 @@ public function template_data()
365365
array(),
366366
array(),
367367
array(),
368-
"VARIABLE\n1_VARIABLE\nVARIABLE\n1_VARIABLE",
368+
"VARIABLE\n1_VARIABLE\nVARIABLE\n1_VARIABLE\nVARIABLE\n1_VARIABLE\nARY_VARIABLE",
369369
),
370370
array(
371371
'lang_twig.html',
372372
array(),
373373
array(),
374374
array(),
375-
"Value'\n1 O'Clock\nValue\\u0027\n1\\u0020O\\u0027Clock",
376-
array('VARIABLE' => "Value'", '1_VARIABLE' => "1 O'Clock"),
375+
"Value'\n1 O'Clock\nValue\\u0027\n1\\u0020O\\u0027Clock\nValue'\n1 O'Clock\nfoo|bar",
376+
array('VARIABLE' => "Value'", '1_VARIABLE' => "1 O'Clock", 'ARY_VARIABLE' => ['foo', 'bar']),
377377
),
378378
array(
379379
'loop_nested_multilevel_ref.html',

tests/template/templates/lang_twig.html

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,7 @@
33

44
{{ lang_js('VARIABLE') }}
55
{{ lang_js('1_VARIABLE') }}
6+
7+
{{ lang_raw('VARIABLE') }}
8+
{{ lang_raw('1_VARIABLE') }}
9+
{{ lang_raw('ARY_VARIABLE')|join('|') }}

0 commit comments

Comments
 (0)