)
}
{
(props.allow.filelist && props.opstate.preload.length &&
-
+
)
}
{
props.allow.reset &&
-
- You have opcache.file_cache_only turned on. As a result, the memory information is not available. Statistics and file list may also not be returned by opcache_get_statistics().
+ {props.txt(`You have opcache.file_cache_only turned on. As a result, the memory information is not available. Statistics and file list may also not be returned by opcache_get_statistics().`)}
);
}
const graphList = [
- {id: 'memoryUsageCanvas', title: 'memory', show: props.highlight.memory, value: props.overview.used_memory_percentage},
- {id: 'hitRateCanvas', title: 'hit rate', show: props.highlight.hits, value: props.overview.hit_rate_percentage},
- {id: 'keyUsageCanvas', title: 'keys', show: props.highlight.keys, value: props.overview.used_key_percentage},
- {id: 'jitUsageCanvas', title: 'jit buffer', show: props.highlight.jit, value: props.overview.jit_buffer_used_percentage}
+ {id: 'memoryUsageCanvas', title: props.txt('memory'), show: props.highlight.memory, value: props.overview.used_memory_percentage},
+ {id: 'hitRateCanvas', title: props.txt('hit rate'), show: props.highlight.hits, value: props.overview.hit_rate_percentage},
+ {id: 'keyUsageCanvas', title: props.txt('keys'), show: props.highlight.keys, value: props.overview.used_key_percentage},
+ {id: 'jitUsageCanvas', title: props.txt('jit buffer'), show: props.highlight.jit, value: props.overview.jit_buffer_used_percentage}
];
return (
@@ -291,6 +309,7 @@ function OverviewCounts(props) {
jitBuffer={props.overview.readable.jit_buffer_size || null}
jitBufferFree={props.overview.readable.jit_buffer_free || null}
jitBufferFreePercentage={props.overview.jit_buffer_used_percentage || null}
+ txt={props.txt}
/>
{props.overview.readable.interned &&
}
@@ -317,15 +338,15 @@ function GeneralInfo(props) {
return (
- General info |
+ {props.txt('General info')} |
Zend OPcache | {props.version.version} |
PHP | {props.version.php} |
- Host | {props.version.host} |
- Server Software | {props.version.server} |
- { props.start ? Start time | {props.start} |
: null }
- { props.reset ? Last reset | {props.reset} |
: null }
+ {props.txt('Host')} | {props.version.host} |
+ {props.txt('Server Software')} | {props.version.server} |
+ { props.start ? {props.txt('Start time')} | {props.start} |
: null }
+ { props.reset ? {props.txt('Last reset')} | {props.reset} |
: null }
);
@@ -352,9 +373,9 @@ function Directives(props) {
});
let vShow;
if (directive.v === true || directive.v === false) {
- vShow = React.createElement('i', {}, directive.v.toString());
+ vShow = React.createElement('i', {}, props.txt(directive.v.toString()));
} else if (directive.v === '') {
- vShow = React.createElement('i', {}, 'no value');
+ vShow = React.createElement('i', {}, props.txt('no value'));
} else {
if (Array.isArray(directive.v)) {
vShow = directiveList(directive);
@@ -364,7 +385,7 @@ function Directives(props) {
}
return (
- {dShow} |
{vShow} |
@@ -373,7 +394,7 @@ function Directives(props) {
return (
- Directives |
+ {props.txt('Directives')} |
{directiveNodes}
);
@@ -383,10 +404,10 @@ function Functions(props) {
return (
- Available functions |
+ {props.txt('Available functions')} |
{props.functions.map(f =>
- {f} |
+ {f} |
)}
@@ -619,13 +640,13 @@ function MemoryUsagePanel(props) {
memory usage
-
total memory: {props.total}
-
used memory: {props.used}
-
free memory: {props.free}
- { props.preload &&
preload memory: {props.preload}
}
-
wasted memory: {props.wasted} ({props.wastedPercent}%)
- { props.jitBuffer &&
jit buffer: {props.jitBuffer}
}
- { props.jitBufferFree &&
jit buffer free: {props.jitBufferFree} ({100 - props.jitBufferFreePercentage}%)
}
+
{props.txt('total memory')}: {props.total}
+
{props.txt('used memory')}: {props.used}
+
{props.txt('free memory')}: {props.free}
+ { props.preload &&
{props.txt('preload memory')}: {props.preload}
}
+
{props.txt('wasted memory')}: {props.wasted} ({props.wastedPercent}%)
+ { props.jitBuffer &&
{props.txt('jit buffer')}: {props.jitBuffer}
}
+ { props.jitBufferFree &&
{props.txt('jit buffer free')}: {props.jitBufferFree} ({100 - props.jitBufferFreePercentage}%)
}
);
@@ -635,14 +656,14 @@ function MemoryUsagePanel(props) {
function StatisticsPanel(props) {
return (
-
opcache statistics
+
{props.txt('opcache statistics')}
-
number of cached files: {props.num_cached_scripts}
-
number of hits: {props.hits}
-
number of misses: {props.misses}
-
blacklist misses: {props.blacklist_miss}
-
number of cached keys: {props.num_cached_keys}
-
max cached keys: {props.max_cached_keys}
+
{props.txt('number of cached')} files: {props.num_cached_scripts}
+
{props.txt('number of hits')}: {props.hits}
+
{props.txt('number of misses')}: {props.misses}
+
{props.txt('blacklist misses')}: {props.blacklist_miss}
+
{props.txt('number of cached keys')}: {props.num_cached_keys}
+
{props.txt('max cached keys')}: {props.max_cached_keys}
);
@@ -652,12 +673,12 @@ function StatisticsPanel(props) {
function InternedStringsPanel(props) {
return (
-
interned strings usage
+
{props.txt('interned strings usage')}
-
buffer size: {props.buffer_size}
-
used memory: {props.strings_used_memory}
-
free memory: {props.strings_free_memory}
-
number of strings: {props.number_of_strings}
+
{props.txt('buffer size')}: {props.buffer_size}
+
{props.txt('used memory')}: {props.strings_used_memory}
+
{props.txt('free memory')}: {props.strings_free_memory}
+
{props.txt('number of strings')}: {props.number_of_strings}
);
@@ -732,7 +753,7 @@ class CachedFiles extends React.Component {
}
if (this.props.allFiles.length === 0) {
- return
No files have been cached or you have opcache.file_cache_only turned on
;
+ return
{this.props.txt('No files have been cached or you have opcache.file_cache_only turned on')}
;
}
const { searchTerm, currentPage } = this.state;
@@ -752,18 +773,19 @@ class CachedFiles extends React.Component {
);
const allFilesTotal = this.props.allFiles.length;
const showingTotal = filesInSearch.length;
+ const showing = showingTotal !== allFilesTotal ? ", {1} showing due to filter '{2}'" : "";
return (
-
{allFilesTotal} files cached{showingTotal !== allFilesTotal && `, ${showingTotal} showing due to filter '${this.state.searchTerm}'`}
+
{this.props.txt(`{0} files cached${showing}`, allFilesTotal, showingTotal, this.state.searchTerm)}
{ this.props.allow.invalidate && this.state.searchTerm && showingTotal !== allFilesTotal &&
-
Invalidate all matching files
+
{this.props.txt('Invalidate all matching files')}
}
@@ -773,18 +795,19 @@ class CachedFiles extends React.Component {
pageNeighbours={2}
onPageChanged={this.onPageChanged}
refresh={this.state.refreshPagination}
+ txt={this.props.txt}
/>}
-
@@ -792,7 +815,7 @@ class CachedFiles extends React.Component {
- Script |
+ {this.props.txt('Script')} |
@@ -801,6 +824,7 @@ class CachedFiles extends React.Component {
key={file.full_path}
canInvalidate={this.props.allow.invalidate}
realtime={this.props.realtime}
+ txt={this.props.txt}
{...file}
/>
})}
@@ -831,15 +855,15 @@ class CachedFile extends React.Component {
{this.props.full_path}
- hits: {this.props.readable.hits},
- memory: {this.props.readable.memory_consumption},
- { this.props.last_modified && <>last modified: {this.props.last_modified}, > }
- last used: {this.props.last_used}
+ {this.props.txt('hits')}: {this.props.readable.hits},
+ {this.props.txt('memory')}: {this.props.readable.memory_consumption},
+ { this.props.last_modified && <>{this.props.txt('last modified')}: {this.props.last_modified}, > }
+ {this.props.txt('last used')}: {this.props.last_used}
- { !this.props.timestamp && - has been invalidated }
+ { !this.props.timestamp && - {this.props.txt('has been invalidated')} }
{ this.props.canInvalidate && , force file invalidation }
+ onClick={this.handleInvalidate}>{this.props.txt('force file invalidation')} }
|
);
@@ -869,7 +893,7 @@ class IgnoredFiles extends React.Component {
}
if (this.props.allFiles.length === 0) {
- return No files have been ignored via opcache.blacklist_filename
;
+ return {this.props.txt('No files have been ignored via opcache.blacklist_filename')}
;
}
const { currentPage } = this.state;
@@ -882,7 +906,7 @@ class IgnoredFiles extends React.Component {
return (
-
{allFilesTotal} ignore file locations
+
{this.props.txt('{0} ignore file locations', allFilesTotal)}
{this.doPagination &&
}
- Path |
+ {this.props.txt('Path')} |
{filesInPage.map((file, index) => {
return {file} |
@@ -928,7 +953,7 @@ class PreloadedFiles extends React.Component {
}
if (this.props.allFiles.length === 0) {
- return No files have been preloaded opcache.preload
;
+ return {this.props.txt('No files have been preloaded opcache.preload')}
;
}
const { currentPage } = this.state;
@@ -941,7 +966,7 @@ class PreloadedFiles extends React.Component {
return (
-
{allFilesTotal} preloaded files
+
{this.props.txt('{0} preloaded files', allFilesTotal)}
{this.doPagination &&
}
- Path |
+ {this.props.txt('Path')} |
{filesInPage.map((file, index) => {
return {file} |
@@ -1086,15 +1112,15 @@ class Pagination extends React.Component {
return (
-
+
↞
- Jump back
+ {this.props.txt('Jump back')}
-
+
⇠
- Previous page
+ {this.props.txt('Previous page')}
@@ -1104,15 +1130,15 @@ class Pagination extends React.Component {
return (
-
+
⇢
- Next page
+ {this.props.txt('Next page')}
-
+
↠
- Jump forward
+ {this.props.txt('Jump forward')}
diff --git a/build/build.php b/build/build.php
index 944b3f0..4d130c6 100644
--- a/build/build.php
+++ b/build/build.php
@@ -29,8 +29,8 @@ $jsOutput = trim(file_get_contents(__DIR__ . '/interface.js'));
$cssOutput = trim(file_get_contents(__DIR__ . '/interface.css'));
$phpOutput = trim(implode('', array_slice(file($parentPath . '/src/Opcache/Service.php'), 3)));
$output = str_replace(
- ['{{JS_OUTPUT}}', '{{CSS_OUTPUT}}', '{{PHP_OUTPUT}}'],
- [$jsOutput, $cssOutput, $phpOutput],
+ ['{{JS_OUTPUT}}', '{{CSS_OUTPUT}}', '{{PHP_OUTPUT}}', '{{LANGUAGE_PACK}}'],
+ [$jsOutput, $cssOutput, $phpOutput, 'null'],
$template
);
if ($makeJsLocal) {
diff --git a/build/template.phps b/build/template.phps
index af0c640..e29b2ab 100644
--- a/build/template.phps
+++ b/build/template.phps
@@ -39,7 +39,8 @@ $options = [
'keys' => true, // show the keys used chart/big number
'jit' => true // show the jit buffer chart/big number
],
- 'language_pack' => null // json structure of all text strings used, or null for default
+ // json structure of all text strings used, or null for default
+ 'language_pack' => {{LANGUAGE_PACK}}
];
/*
@@ -101,7 +102,8 @@ $opcache = (new Service($options))->handle();
highlight: = json_encode($opcache->getOption('highlight')); ?>,
debounceRate: = $opcache->getOption('debounce_rate'); ?>,
perPageLimit: = json_encode($opcache->getOption('per_page')); ?>,
- realtimeRefresh: = json_encode($opcache->getOption('refresh_time')); ?>
+ realtimeRefresh: = json_encode($opcache->getOption('refresh_time')); ?>,
+ language: = json_encode($opcache->getOption('language_pack')); ?>,
}), document.getElementById('interface'));
diff --git a/index.php b/index.php
index 898d0dc..9e8a415 100644
--- a/index.php
+++ b/index.php
@@ -20,24 +20,27 @@ namespace Amnuts\Opcache;
*/
$options = [
- 'allow_filelist' => true, // show/hide the files tab
- 'allow_invalidate' => true, // give a link to invalidate files
- 'allow_reset' => true, // give option to reset the whole cache
- 'allow_realtime' => true, // give option to enable/disable real-time updates
- 'refresh_time' => 5, // how often the data will refresh, in seconds
- 'size_precision' => 2, // Digits after decimal point
- 'size_space' => false, // have '1MB' or '1 MB' when showing sizes
- 'charts' => true, // show gauge chart or just big numbers
- 'debounce_rate' => 250, // milliseconds after key press to send keyup event when filtering
- 'per_page' => 200, // How many results per page to show in the file list, false for no pagination
- 'cookie_name' => 'opcachegui', // name of cookie
- 'cookie_ttl' => 365, // days to store cookie
+ 'allow_filelist' => true, // show/hide the files tab
+ 'allow_invalidate' => true, // give a link to invalidate files
+ 'allow_reset' => true, // give option to reset the whole cache
+ 'allow_realtime' => true, // give option to enable/disable real-time updates
+ 'refresh_time' => 5, // how often the data will refresh, in seconds
+ 'size_precision' => 2, // Digits after decimal point
+ 'size_space' => false, // have '1MB' or '1 MB' when showing sizes
+ 'charts' => true, // show gauge chart or just big numbers
+ 'debounce_rate' => 250, // milliseconds after key press to send keyup event when filtering
+ 'per_page' => 200, // How many results per page to show in the file list, false for no pagination
+ 'cookie_name' => 'opcachegui', // name of cookie
+ 'cookie_ttl' => 365, // days to store cookie
+ 'datetime_format' => 'D, d M Y H:i:s O', // Show datetime in this format
'highlight' => [
- 'memory' => true, // show the memory chart/big number
- 'hits' => true, // show the hit rate chart/big number
- 'keys' => true, // show the keys used chart/big number
- 'jit' => true // show the jit buffer chart/big number
- ]
+ 'memory' => true, // show the memory chart/big number
+ 'hits' => true, // show the hit rate chart/big number
+ 'keys' => true, // show the keys used chart/big number
+ 'jit' => true // show the jit buffer chart/big number
+ ],
+ // json structure of all text strings used, or null for default
+ 'language_pack' => null
];
/*
@@ -68,6 +71,12 @@ class Service
protected $data;
protected $options;
protected $optimizationLevels;
+ protected $jitModes;
+ protected $jitModeMapping = [
+ 'tracing' => 1254,
+ 'on' => 1254,
+ 'function' => 1205
+ ];
protected $defaults = [
'allow_filelist' => true, // show/hide the files tab
'allow_invalidate' => true, // give a link to invalidate files
@@ -87,51 +96,8 @@ class Service
'hits' => true, // show the hit rate chart/big number
'keys' => true, // show the keys used chart/big number
'jit' => true // show the jit buffer chart/big number
- ]
- ];
- protected $jitModes = [
- [
- 'flag' => 'CPU-specific optimization',
- 'value' => [
- 'Disable CPU-specific optimization',
- 'Enable use of AVX, if the CPU supports it'
- ]
],
- [
- 'flag' => 'Register allocation',
- 'value' => [
- 'Do not perform register allocation',
- 'Perform block-local register allocation',
- 'Perform global register allocation'
- ]
- ],
- [
- 'flag' => 'Trigger',
- 'value' => [
- 'Compile all functions on script load',
- 'Compile functions on first execution',
- 'Profile functions on first request and compile the hottest functions afterwards',
- 'Profile on the fly and compile hot functions',
- 'Currently unused',
- 'Use tracing JIT. Profile on the fly and compile traces for hot code segments'
- ]
- ],
- [
- 'flag' => 'Optimization level',
- 'value' => [
- 'No JIT',
- 'Minimal JIT (call standard VM handlers)',
- 'Inline VM handlers',
- 'Use type inference',
- 'Use call graph',
- 'Optimize whole script'
- ]
- ]
- ];
- protected $jitModeMapping = [
- 'tracing' => 1254,
- 'on' => 1254,
- 'function' => 1205
+ 'language_pack' => null // json structure of all text strings used, or null for default
];
/**
@@ -141,29 +107,89 @@ class Service
*/
public function __construct(array $options = [])
{
- $this->optimizationLevels = [
- 1 << 0 => 'CSE, STRING construction',
- 1 << 1 => 'Constant conversion and jumps',
- 1 << 2 => '++, +=, series of jumps',
- 1 << 3 => 'INIT_FCALL_BY_NAME -> DO_FCALL',
- 1 << 4 => 'CFG based optimization',
- 1 << 5 => 'DFA based optimization',
- 1 << 6 => 'CALL GRAPH optimization',
- 1 << 7 => 'SCCP (constant propagation)',
- 1 << 8 => 'TMP VAR usage',
- 1 << 9 => 'NOP removal',
- 1 << 10 => 'Merge equal constants',
- 1 << 11 => 'Adjust used stack',
- 1 << 12 => 'Remove unused variables',
- 1 << 13 => 'DCE (dead code elimination)',
- 1 << 14 => '(unsafe) Collect constants',
- 1 << 15 => 'Inline functions'
- ];
$this->options = array_merge($this->defaults, $options);
$this->tz = new DateTimeZone(date_default_timezone_get());
+ if (is_string($this->options['language_pack'])) {
+ $this->options['language_pack'] = json_decode($this->options['language_pack'], true);
+ }
+
+ $this->optimizationLevels = [
+ 1 << 0 => $this->txt('CSE, STRING construction'),
+ 1 << 1 => $this->txt('Constant conversion and jumps'),
+ 1 << 2 => $this->txt('++, +=, series of jumps'),
+ 1 << 3 => $this->txt('INIT_FCALL_BY_NAME -> DO_FCALL'),
+ 1 << 4 => $this->txt('CFG based optimization'),
+ 1 << 5 => $this->txt('DFA based optimization'),
+ 1 << 6 => $this->txt('CALL GRAPH optimization'),
+ 1 << 7 => $this->txt('SCCP (constant propagation)'),
+ 1 << 8 => $this->txt('TMP VAR usage'),
+ 1 << 9 => $this->txt('NOP removal'),
+ 1 << 10 => $this->txt('Merge equal constants'),
+ 1 << 11 => $this->txt('Adjust used stack'),
+ 1 << 12 => $this->txt('Remove unused variables'),
+ 1 << 13 => $this->txt('DCE (dead code elimination)'),
+ 1 << 14 => $this->txt('(unsafe) Collect constants'),
+ 1 << 15 => $this->txt('Inline functions'),
+ ];
+ $this->jitModes = [
+ [
+ 'flag' => $this->txt('CPU-specific optimization'),
+ 'value' => [
+ $this->txt('Disable CPU-specific optimization'),
+ $this->txt('Enable use of AVX, if the CPU supports it')
+ ]
+ ],
+ [
+ 'flag' => $this->txt('Register allocation'),
+ 'value' => [
+ $this->txt('Do not perform register allocation'),
+ $this->txt('Perform block-local register allocation'),
+ $this->txt('Perform global register allocation')
+ ]
+ ],
+ [
+ 'flag' => $this->txt('Trigger'),
+ 'value' => [
+ $this->txt('Compile all functions on script load'),
+ $this->txt('Compile functions on first execution'),
+ $this->txt('Profile functions on first request and compile the hottest functions afterwards'),
+ $this->txt('Profile on the fly and compile hot functions'),
+ $this->txt('Currently unused'),
+ $this->txt('Use tracing JIT. Profile on the fly and compile traces for hot code segments')
+ ]
+ ],
+ [
+ 'flag' => $this->txt('Optimization level'),
+ 'value' => [
+ $this->txt('No JIT'),
+ $this->txt('Minimal JIT (call standard VM handlers)'),
+ $this->txt('Inline VM handlers'),
+ $this->txt('Use type inference'),
+ $this->txt('Use call graph'),
+ $this->txt('Optimize whole script')
+ ]
+ ]
+ ];
+
$this->data = $this->compileState();
}
+ /**
+ * @return string
+ */
+ public function txt(): string
+ {
+ $args = func_get_args();
+ $text = array_shift($args);
+ if ((($lang = $this->getOption('language_pack')) !== null) && !empty($lang[$text])) {
+ $text = $lang[$text];
+ }
+ foreach ($args as $i => $arg) {
+ $text = str_replace('{' . $i . '}', $arg, $text);
+ }
+ return $text;
+ }
+
/**
* @return $this
* @throws Exception
@@ -575,6 +601,17 @@ class Interface extends React.Component {
return v ? !!v[2] : false;
});
+ _defineProperty(this, "txt", (text, ...args) => {
+ if (this.props.language !== null && this.props.language.hasOwnProperty(text) && this.props.language[text]) {
+ text = this.props.language[text];
+ }
+
+ args.forEach((arg, i) => {
+ text = text.replaceAll(`{${i}}`, arg);
+ });
+ return text;
+ });
+
this.state = {
realtime: this.getCookie(),
resetting: false,
@@ -599,7 +636,8 @@ class Interface extends React.Component {
realtime: this.state.realtime,
resetting: this.state.resetting,
realtimeHandler: this.realtimeHandler,
- resetHandler: this.resetHandler
+ resetHandler: this.resetHandler,
+ txt: this.txt
}))), /*#__PURE__*/React.createElement(Footer, {
version: this.props.opstate.version.gui
}));
@@ -611,26 +649,30 @@ function MainNavigation(props) {
return /*#__PURE__*/React.createElement("nav", {
className: "main-nav"
}, /*#__PURE__*/React.createElement(Tabs, null, /*#__PURE__*/React.createElement("div", {
- label: "Overview",
+ label: props.txt("Overview"),
tabId: "overview",
tabIndex: 1
}, /*#__PURE__*/React.createElement(OverviewCounts, {
overview: props.opstate.overview,
highlight: props.highlight,
- useCharts: props.useCharts
+ useCharts: props.useCharts,
+ txt: props.txt
}), /*#__PURE__*/React.createElement("div", {
id: "info",
className: "tab-content-overview-info"
}, /*#__PURE__*/React.createElement(GeneralInfo, {
start: props.opstate.overview && props.opstate.overview.readable.start_time || null,
reset: props.opstate.overview && props.opstate.overview.readable.last_restart_time || null,
- version: props.opstate.version
+ version: props.opstate.version,
+ txt: props.txt
}), /*#__PURE__*/React.createElement(Directives, {
- directives: props.opstate.directives
+ directives: props.opstate.directives,
+ txt: props.txt
}), /*#__PURE__*/React.createElement(Functions, {
- functions: props.opstate.functions
+ functions: props.opstate.functions,
+ txt: props.txt
}))), props.allow.filelist && /*#__PURE__*/React.createElement("div", {
- label: "Cached",
+ label: props.txt("Cached"),
tabId: "cached",
tabIndex: 2
}, /*#__PURE__*/React.createElement(CachedFiles, {
@@ -642,9 +684,10 @@ function MainNavigation(props) {
fileList: props.allow.filelist,
invalidate: props.allow.invalidate
},
- realtime: props.realtime
+ realtime: props.realtime,
+ txt: props.txt
})), props.allow.filelist && props.opstate.blacklist.length && /*#__PURE__*/React.createElement("div", {
- label: "Ignored",
+ label: props.txt("Ignored"),
tabId: "ignored",
tabIndex: 3
}, /*#__PURE__*/React.createElement(IgnoredFiles, {
@@ -652,9 +695,10 @@ function MainNavigation(props) {
allFiles: props.opstate.blacklist,
allow: {
fileList: props.allow.filelist
- }
+ },
+ txt: props.txt
})), props.allow.filelist && props.opstate.preload.length && /*#__PURE__*/React.createElement("div", {
- label: "Preloaded",
+ label: props.txt("Preloaded"),
tabId: "preloaded",
tabIndex: 4
}, /*#__PURE__*/React.createElement(PreloadedFiles, {
@@ -662,15 +706,16 @@ function MainNavigation(props) {
allFiles: props.opstate.preload,
allow: {
fileList: props.allow.filelist
- }
+ },
+ txt: props.txt
})), props.allow.reset && /*#__PURE__*/React.createElement("div", {
- label: "Reset cache",
+ label: props.txt("Reset cache"),
tabId: "resetCache",
className: `nav-tab-link-reset${props.resetting ? ' is-resetting pulse' : ''}`,
handler: props.resetHandler,
tabIndex: 5
}), props.allow.realtime && /*#__PURE__*/React.createElement("div", {
- label: `${props.realtime ? 'Disable' : 'Enable'} real-time update`,
+ label: props.txt(`${props.realtime ? 'Disable' : 'Enable'} real-time update`),
tabId: "toggleRealtime",
className: `nav-tab-link-realtime${props.realtime ? ' live-update pulse' : ''}`,
handler: props.realtimeHandler,
@@ -781,27 +826,27 @@ function OverviewCounts(props) {
if (props.overview === false) {
return /*#__PURE__*/React.createElement("p", {
class: "file-cache-only"
- }, "You have ", /*#__PURE__*/React.createElement("i", null, "opcache.file_cache_only"), " turned on. As a result, the memory information is not available. Statistics and file list may also not be returned by ", /*#__PURE__*/React.createElement("i", null, "opcache_get_statistics()"), ".");
+ }, props.txt(`You have opcache.file_cache_only turned on. As a result, the memory information is not available. Statistics and file list may also not be returned by opcache_get_statistics().`));
}
const graphList = [{
id: 'memoryUsageCanvas',
- title: 'memory',
+ title: props.txt('memory'),
show: props.highlight.memory,
value: props.overview.used_memory_percentage
}, {
id: 'hitRateCanvas',
- title: 'hit rate',
+ title: props.txt('hit rate'),
show: props.highlight.hits,
value: props.overview.hit_rate_percentage
}, {
id: 'keyUsageCanvas',
- title: 'keys',
+ title: props.txt('keys'),
show: props.highlight.keys,
value: props.overview.used_key_percentage
}, {
id: 'jitUsageCanvas',
- title: 'jit buffer',
+ title: props.txt('jit buffer'),
show: props.highlight.jit,
value: props.overview.jit_buffer_used_percentage
}];
@@ -832,19 +877,22 @@ function OverviewCounts(props) {
wastedPercent: props.overview.wasted_percentage,
jitBuffer: props.overview.readable.jit_buffer_size || null,
jitBufferFree: props.overview.readable.jit_buffer_free || null,
- jitBufferFreePercentage: props.overview.jit_buffer_used_percentage || null
+ jitBufferFreePercentage: props.overview.jit_buffer_used_percentage || null,
+ txt: props.txt
}), /*#__PURE__*/React.createElement(StatisticsPanel, {
num_cached_scripts: props.overview.readable.num_cached_scripts,
hits: props.overview.readable.hits,
misses: props.overview.readable.misses,
blacklist_miss: props.overview.readable.blacklist_miss,
num_cached_keys: props.overview.readable.num_cached_keys,
- max_cached_keys: props.overview.readable.max_cached_keys
+ max_cached_keys: props.overview.readable.max_cached_keys,
+ txt: props.txt
}), props.overview.readable.interned && /*#__PURE__*/React.createElement(InternedStringsPanel, {
buffer_size: props.overview.readable.interned.buffer_size,
strings_used_memory: props.overview.readable.interned.strings_used_memory,
strings_free_memory: props.overview.readable.interned.strings_free_memory,
- number_of_strings: props.overview.readable.interned.number_of_strings
+ number_of_strings: props.overview.readable.interned.number_of_strings,
+ txt: props.txt
}));
}
@@ -853,7 +901,7 @@ function GeneralInfo(props) {
className: "tables general-info-table"
}, /*#__PURE__*/React.createElement("thead", null, /*#__PURE__*/React.createElement("tr", null, /*#__PURE__*/React.createElement("th", {
colSpan: "2"
- }, "General info"))), /*#__PURE__*/React.createElement("tbody", null, /*#__PURE__*/React.createElement("tr", null, /*#__PURE__*/React.createElement("td", null, "Zend OPcache"), /*#__PURE__*/React.createElement("td", null, props.version.version)), /*#__PURE__*/React.createElement("tr", null, /*#__PURE__*/React.createElement("td", null, "PHP"), /*#__PURE__*/React.createElement("td", null, props.version.php)), /*#__PURE__*/React.createElement("tr", null, /*#__PURE__*/React.createElement("td", null, "Host"), /*#__PURE__*/React.createElement("td", null, props.version.host)), /*#__PURE__*/React.createElement("tr", null, /*#__PURE__*/React.createElement("td", null, "Server Software"), /*#__PURE__*/React.createElement("td", null, props.version.server)), props.start ? /*#__PURE__*/React.createElement("tr", null, /*#__PURE__*/React.createElement("td", null, "Start time"), /*#__PURE__*/React.createElement("td", null, props.start)) : null, props.reset ? /*#__PURE__*/React.createElement("tr", null, /*#__PURE__*/React.createElement("td", null, "Last reset"), /*#__PURE__*/React.createElement("td", null, props.reset)) : null));
+ }, props.txt('General info')))), /*#__PURE__*/React.createElement("tbody", null, /*#__PURE__*/React.createElement("tr", null, /*#__PURE__*/React.createElement("td", null, "Zend OPcache"), /*#__PURE__*/React.createElement("td", null, props.version.version)), /*#__PURE__*/React.createElement("tr", null, /*#__PURE__*/React.createElement("td", null, "PHP"), /*#__PURE__*/React.createElement("td", null, props.version.php)), /*#__PURE__*/React.createElement("tr", null, /*#__PURE__*/React.createElement("td", null, props.txt('Host')), /*#__PURE__*/React.createElement("td", null, props.version.host)), /*#__PURE__*/React.createElement("tr", null, /*#__PURE__*/React.createElement("td", null, props.txt('Server Software')), /*#__PURE__*/React.createElement("td", null, props.version.server)), props.start ? /*#__PURE__*/React.createElement("tr", null, /*#__PURE__*/React.createElement("td", null, props.txt('Start time')), /*#__PURE__*/React.createElement("td", null, props.start)) : null, props.reset ? /*#__PURE__*/React.createElement("tr", null, /*#__PURE__*/React.createElement("td", null, props.txt('Last reset')), /*#__PURE__*/React.createElement("td", null, props.reset)) : null));
}
function Directives(props) {
@@ -882,9 +930,9 @@ function Directives(props) {
let vShow;
if (directive.v === true || directive.v === false) {
- vShow = React.createElement('i', {}, directive.v.toString());
+ vShow = React.createElement('i', {}, props.txt(directive.v.toString()));
} else if (directive.v === '') {
- vShow = React.createElement('i', {}, 'no value');
+ vShow = React.createElement('i', {}, props.txt('no value'));
} else {
if (Array.isArray(directive.v)) {
vShow = directiveList(directive);
@@ -896,7 +944,7 @@ function Directives(props) {
return /*#__PURE__*/React.createElement("tr", {
key: directive.k
}, /*#__PURE__*/React.createElement("td", {
- title: 'View ' + directive.k + ' manual entry'
+ title: props.txt('View {0} manual entry', directive.k)
}, /*#__PURE__*/React.createElement("a", {
href: 'https://php.net/manual/en/opcache.configuration.php#ini.' + directive.k.replace(/_/g, '-'),
target: "_blank"
@@ -906,7 +954,7 @@ function Directives(props) {
className: "tables directives-table"
}, /*#__PURE__*/React.createElement("thead", null, /*#__PURE__*/React.createElement("tr", null, /*#__PURE__*/React.createElement("th", {
colSpan: "2"
- }, "Directives"))), /*#__PURE__*/React.createElement("tbody", null, directiveNodes));
+ }, props.txt('Directives')))), /*#__PURE__*/React.createElement("tbody", null, directiveNodes));
}
function Functions(props) {
@@ -914,11 +962,11 @@ function Functions(props) {
id: "functions"
}, /*#__PURE__*/React.createElement("table", {
className: "tables"
- }, /*#__PURE__*/React.createElement("thead", null, /*#__PURE__*/React.createElement("tr", null, /*#__PURE__*/React.createElement("th", null, "Available functions"))), /*#__PURE__*/React.createElement("tbody", null, props.functions.map(f => /*#__PURE__*/React.createElement("tr", {
+ }, /*#__PURE__*/React.createElement("thead", null, /*#__PURE__*/React.createElement("tr", null, /*#__PURE__*/React.createElement("th", null, props.txt('Available functions')))), /*#__PURE__*/React.createElement("tbody", null, props.functions.map(f => /*#__PURE__*/React.createElement("tr", {
key: f
}, /*#__PURE__*/React.createElement("td", null, /*#__PURE__*/React.createElement("a", {
href: "https://php.net/" + f,
- title: "View manual page",
+ title: props.txt('View manual page'),
target: "_blank"
}, f)))))));
}
@@ -1149,7 +1197,7 @@ function MemoryUsagePanel(props) {
className: "widget-header"
}, "memory usage"), /*#__PURE__*/React.createElement("div", {
className: "widget-value widget-info"
- }, /*#__PURE__*/React.createElement("p", null, /*#__PURE__*/React.createElement("b", null, "total memory:"), " ", props.total), /*#__PURE__*/React.createElement("p", null, /*#__PURE__*/React.createElement("b", null, "used memory:"), " ", props.used), /*#__PURE__*/React.createElement("p", null, /*#__PURE__*/React.createElement("b", null, "free memory:"), " ", props.free), props.preload && /*#__PURE__*/React.createElement("p", null, /*#__PURE__*/React.createElement("b", null, "preload memory:"), " ", props.preload), /*#__PURE__*/React.createElement("p", null, /*#__PURE__*/React.createElement("b", null, "wasted memory:"), " ", props.wasted, " (", props.wastedPercent, "%)"), props.jitBuffer && /*#__PURE__*/React.createElement("p", null, /*#__PURE__*/React.createElement("b", null, "jit buffer:"), " ", props.jitBuffer), props.jitBufferFree && /*#__PURE__*/React.createElement("p", null, /*#__PURE__*/React.createElement("b", null, "jit buffer free:"), " ", props.jitBufferFree, " (", 100 - props.jitBufferFreePercentage, "%)")));
+ }, /*#__PURE__*/React.createElement("p", null, /*#__PURE__*/React.createElement("b", null, props.txt('total memory'), ":"), " ", props.total), /*#__PURE__*/React.createElement("p", null, /*#__PURE__*/React.createElement("b", null, props.txt('used memory'), ":"), " ", props.used), /*#__PURE__*/React.createElement("p", null, /*#__PURE__*/React.createElement("b", null, props.txt('free memory'), ":"), " ", props.free), props.preload && /*#__PURE__*/React.createElement("p", null, /*#__PURE__*/React.createElement("b", null, props.txt('preload memory'), ":"), " ", props.preload), /*#__PURE__*/React.createElement("p", null, /*#__PURE__*/React.createElement("b", null, props.txt('wasted memory'), ":"), " ", props.wasted, " (", props.wastedPercent, "%)"), props.jitBuffer && /*#__PURE__*/React.createElement("p", null, /*#__PURE__*/React.createElement("b", null, props.txt('jit buffer'), ":"), " ", props.jitBuffer), props.jitBufferFree && /*#__PURE__*/React.createElement("p", null, /*#__PURE__*/React.createElement("b", null, props.txt('jit buffer free'), ":"), " ", props.jitBufferFree, " (", 100 - props.jitBufferFreePercentage, "%)")));
}
function StatisticsPanel(props) {
@@ -1157,9 +1205,9 @@ function StatisticsPanel(props) {
className: "widget-panel"
}, /*#__PURE__*/React.createElement("h3", {
className: "widget-header"
- }, "opcache statistics"), /*#__PURE__*/React.createElement("div", {
+ }, props.txt('opcache statistics')), /*#__PURE__*/React.createElement("div", {
className: "widget-value widget-info"
- }, /*#__PURE__*/React.createElement("p", null, /*#__PURE__*/React.createElement("b", null, "number of cached files:"), " ", props.num_cached_scripts), /*#__PURE__*/React.createElement("p", null, /*#__PURE__*/React.createElement("b", null, "number of hits:"), " ", props.hits), /*#__PURE__*/React.createElement("p", null, /*#__PURE__*/React.createElement("b", null, "number of misses:"), " ", props.misses), /*#__PURE__*/React.createElement("p", null, /*#__PURE__*/React.createElement("b", null, "blacklist misses:"), " ", props.blacklist_miss), /*#__PURE__*/React.createElement("p", null, /*#__PURE__*/React.createElement("b", null, "number of cached keys:"), " ", props.num_cached_keys), /*#__PURE__*/React.createElement("p", null, /*#__PURE__*/React.createElement("b", null, "max cached keys:"), " ", props.max_cached_keys)));
+ }, /*#__PURE__*/React.createElement("p", null, /*#__PURE__*/React.createElement("b", null, props.txt('number of cached'), " files:"), " ", props.num_cached_scripts), /*#__PURE__*/React.createElement("p", null, /*#__PURE__*/React.createElement("b", null, props.txt('number of hits'), ":"), " ", props.hits), /*#__PURE__*/React.createElement("p", null, /*#__PURE__*/React.createElement("b", null, props.txt('number of misses'), ":"), " ", props.misses), /*#__PURE__*/React.createElement("p", null, /*#__PURE__*/React.createElement("b", null, props.txt('blacklist misses'), ":"), " ", props.blacklist_miss), /*#__PURE__*/React.createElement("p", null, /*#__PURE__*/React.createElement("b", null, props.txt('number of cached keys'), ":"), " ", props.num_cached_keys), /*#__PURE__*/React.createElement("p", null, /*#__PURE__*/React.createElement("b", null, props.txt('max cached keys'), ":"), " ", props.max_cached_keys)));
}
function InternedStringsPanel(props) {
@@ -1167,9 +1215,9 @@ function InternedStringsPanel(props) {
className: "widget-panel"
}, /*#__PURE__*/React.createElement("h3", {
className: "widget-header"
- }, "interned strings usage"), /*#__PURE__*/React.createElement("div", {
+ }, props.txt('interned strings usage')), /*#__PURE__*/React.createElement("div", {
className: "widget-value widget-info"
- }, /*#__PURE__*/React.createElement("p", null, /*#__PURE__*/React.createElement("b", null, "buffer size:"), " ", props.buffer_size), /*#__PURE__*/React.createElement("p", null, /*#__PURE__*/React.createElement("b", null, "used memory:"), " ", props.strings_used_memory), /*#__PURE__*/React.createElement("p", null, /*#__PURE__*/React.createElement("b", null, "free memory:"), " ", props.strings_free_memory), /*#__PURE__*/React.createElement("p", null, /*#__PURE__*/React.createElement("b", null, "number of strings:"), " ", props.number_of_strings)));
+ }, /*#__PURE__*/React.createElement("p", null, /*#__PURE__*/React.createElement("b", null, props.txt('buffer size'), ":"), " ", props.buffer_size), /*#__PURE__*/React.createElement("p", null, /*#__PURE__*/React.createElement("b", null, props.txt('used memory'), ":"), " ", props.strings_used_memory), /*#__PURE__*/React.createElement("p", null, /*#__PURE__*/React.createElement("b", null, props.txt('free memory'), ":"), " ", props.strings_free_memory), /*#__PURE__*/React.createElement("p", null, /*#__PURE__*/React.createElement("b", null, props.txt('number of strings'), ":"), " ", props.number_of_strings)));
}
class CachedFiles extends React.Component {
@@ -1247,7 +1295,7 @@ class CachedFiles extends React.Component {
}
if (this.props.allFiles.length === 0) {
- return /*#__PURE__*/React.createElement("p", null, "No files have been cached or you have ", /*#__PURE__*/React.createElement("i", null, "opcache.file_cache_only"), " turned on");
+ return /*#__PURE__*/React.createElement("p", null, this.props.txt('No files have been cached or you have opcache.file_cache_only turned on'));
}
const {
@@ -1262,11 +1310,12 @@ class CachedFiles extends React.Component {
const filesInPage = this.doPagination ? filesInSearch.slice(offset, offset + this.props.perPageLimit) : filesInSearch;
const allFilesTotal = this.props.allFiles.length;
const showingTotal = filesInSearch.length;
+ const showing = showingTotal !== allFilesTotal ? ", {1} showing due to filter '{2}'" : "";
return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("form", {
action: "#"
}, /*#__PURE__*/React.createElement("label", {
htmlFor: "frmFilter"
- }, "Start typing to filter on script path"), /*#__PURE__*/React.createElement("br", null), /*#__PURE__*/React.createElement("input", {
+ }, this.props.txt('Start typing to filter on script path')), /*#__PURE__*/React.createElement("br", null), /*#__PURE__*/React.createElement("input", {
type: "text",
name: "filter",
id: "frmFilter",
@@ -1274,49 +1323,51 @@ class CachedFiles extends React.Component {
onChange: e => {
this.setSearchTerm(e.target.value);
}
- })), /*#__PURE__*/React.createElement("h3", null, allFilesTotal, " files cached", showingTotal !== allFilesTotal && `, ${showingTotal} showing due to filter '${this.state.searchTerm}'`), this.props.allow.invalidate && this.state.searchTerm && showingTotal !== allFilesTotal && /*#__PURE__*/React.createElement("p", null, /*#__PURE__*/React.createElement("a", {
+ })), /*#__PURE__*/React.createElement("h3", null, this.props.txt(`{0} files cached${showing}`, allFilesTotal, showingTotal, this.state.searchTerm)), this.props.allow.invalidate && this.state.searchTerm && showingTotal !== allFilesTotal && /*#__PURE__*/React.createElement("p", null, /*#__PURE__*/React.createElement("a", {
href: `?invalidate_searched=${encodeURIComponent(this.state.searchTerm)}`,
onClick: this.handleInvalidate
- }, "Invalidate all matching files")), /*#__PURE__*/React.createElement("div", {
+ }, this.props.txt('Invalidate all matching files'))), /*#__PURE__*/React.createElement("div", {
className: "paginate-filter"
}, this.doPagination && /*#__PURE__*/React.createElement(Pagination, {
totalRecords: filesInSearch.length,
pageLimit: this.props.perPageLimit,
pageNeighbours: 2,
onPageChanged: this.onPageChanged,
- refresh: this.state.refreshPagination
+ refresh: this.state.refreshPagination,
+ txt: this.props.txt
}), /*#__PURE__*/React.createElement("nav", {
className: "filter",
- "aria-label": "Sort order"
+ "aria-label": this.props.txt('Sort order')
}, /*#__PURE__*/React.createElement("select", {
name: "sortBy",
onChange: this.changeSort,
value: this.state.sortBy
}, /*#__PURE__*/React.createElement("option", {
value: "last_used_timestamp"
- }, "Last used"), /*#__PURE__*/React.createElement("option", {
+ }, this.props.txt('Last used')), /*#__PURE__*/React.createElement("option", {
value: "last_modified"
- }, "Last modified"), /*#__PURE__*/React.createElement("option", {
+ }, this.props.txt('Last modified')), /*#__PURE__*/React.createElement("option", {
value: "full_path"
- }, "Path"), /*#__PURE__*/React.createElement("option", {
+ }, this.props.txt('Path')), /*#__PURE__*/React.createElement("option", {
value: "hits"
- }, "Number of hits"), /*#__PURE__*/React.createElement("option", {
+ }, this.props.txt('Number of hits')), /*#__PURE__*/React.createElement("option", {
value: "memory_consumption"
- }, "Memory consumption")), /*#__PURE__*/React.createElement("select", {
+ }, this.props.txt('Memory consumption'))), /*#__PURE__*/React.createElement("select", {
name: "sortDir",
onChange: this.changeSort,
value: this.state.sortDir
}, /*#__PURE__*/React.createElement("option", {
value: "desc"
- }, "Descending"), /*#__PURE__*/React.createElement("option", {
+ }, this.props.txt('Descending')), /*#__PURE__*/React.createElement("option", {
value: "asc"
- }, "Ascending")))), /*#__PURE__*/React.createElement("table", {
+ }, this.props.txt('Ascending'))))), /*#__PURE__*/React.createElement("table", {
className: "tables cached-list-table"
- }, /*#__PURE__*/React.createElement("thead", null, /*#__PURE__*/React.createElement("tr", null, /*#__PURE__*/React.createElement("th", null, "Script"))), /*#__PURE__*/React.createElement("tbody", null, filesInPage.map((file, index) => {
+ }, /*#__PURE__*/React.createElement("thead", null, /*#__PURE__*/React.createElement("tr", null, /*#__PURE__*/React.createElement("th", null, this.props.txt('Script')))), /*#__PURE__*/React.createElement("tbody", null, filesInPage.map((file, index) => {
return /*#__PURE__*/React.createElement(CachedFile, _extends({
key: file.full_path,
canInvalidate: this.props.allow.invalidate,
- realtime: this.props.realtime
+ realtime: this.props.realtime,
+ txt: this.props.txt
}, file));
}))));
}
@@ -1351,14 +1402,14 @@ class CachedFile extends React.Component {
className: "file-pathname"
}, this.props.full_path), /*#__PURE__*/React.createElement("span", {
className: "file-metainfo"
- }, /*#__PURE__*/React.createElement("b", null, "hits: "), /*#__PURE__*/React.createElement("span", null, this.props.readable.hits, ", "), /*#__PURE__*/React.createElement("b", null, "memory: "), /*#__PURE__*/React.createElement("span", null, this.props.readable.memory_consumption, ", "), this.props.last_modified && /*#__PURE__*/React.createElement("span", null, /*#__PURE__*/React.createElement("b", null, "last modified: "), /*#__PURE__*/React.createElement("span", null, this.props.last_modified, ", ")), /*#__PURE__*/React.createElement("b", null, "last used: "), /*#__PURE__*/React.createElement("span", null, this.props.last_used)), !this.props.timestamp && /*#__PURE__*/React.createElement("span", {
+ }, /*#__PURE__*/React.createElement("b", null, this.props.txt('hits'), ": "), /*#__PURE__*/React.createElement("span", null, this.props.readable.hits, ", "), /*#__PURE__*/React.createElement("b", null, this.props.txt('memory'), ": "), /*#__PURE__*/React.createElement("span", null, this.props.readable.memory_consumption, ", "), this.props.last_modified && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("b", null, this.props.txt('last modified'), ": "), /*#__PURE__*/React.createElement("span", null, this.props.last_modified, ", ")), /*#__PURE__*/React.createElement("b", null, this.props.txt('last used'), ": "), /*#__PURE__*/React.createElement("span", null, this.props.last_used)), !this.props.timestamp && /*#__PURE__*/React.createElement("span", {
className: "invalid file-metainfo"
- }, " - has been invalidated"), this.props.canInvalidate && /*#__PURE__*/React.createElement("span", null, ",\xA0", /*#__PURE__*/React.createElement("a", {
+ }, " - ", this.props.txt('has been invalidated')), this.props.canInvalidate && /*#__PURE__*/React.createElement("span", null, ",\xA0", /*#__PURE__*/React.createElement("a", {
className: "file-metainfo",
href: '?invalidate=' + this.props.full_path,
"data-file": this.props.full_path,
onClick: this.handleInvalidate
- }, "force file invalidation"))));
+ }, this.props.txt('force file invalidation')))));
}
}
@@ -1386,7 +1437,7 @@ class IgnoredFiles extends React.Component {
}
if (this.props.allFiles.length === 0) {
- return /*#__PURE__*/React.createElement("p", null, "No files have been ignored via ", /*#__PURE__*/React.createElement("i", null, "opcache.blacklist_filename"));
+ return /*#__PURE__*/React.createElement("p", null, this.props.txt('No files have been ignored via opcache.blacklist_filename'));
}
const {
@@ -1395,15 +1446,16 @@ class IgnoredFiles extends React.Component {
const offset = (currentPage - 1) * this.props.perPageLimit;
const filesInPage = this.doPagination ? this.props.allFiles.slice(offset, offset + this.props.perPageLimit) : this.props.allFiles;
const allFilesTotal = this.props.allFiles.length;
- return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("h3", null, allFilesTotal, " ignore file locations"), this.doPagination && /*#__PURE__*/React.createElement(Pagination, {
+ return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("h3", null, this.props.txt('{0} ignore file locations', allFilesTotal)), this.doPagination && /*#__PURE__*/React.createElement(Pagination, {
totalRecords: allFilesTotal,
pageLimit: this.props.perPageLimit,
pageNeighbours: 2,
onPageChanged: this.onPageChanged,
- refresh: this.state.refreshPagination
+ refresh: this.state.refreshPagination,
+ txt: this.props.txt
}), /*#__PURE__*/React.createElement("table", {
className: "tables ignored-list-table"
- }, /*#__PURE__*/React.createElement("thead", null, /*#__PURE__*/React.createElement("tr", null, /*#__PURE__*/React.createElement("th", null, "Path"))), /*#__PURE__*/React.createElement("tbody", null, filesInPage.map((file, index) => {
+ }, /*#__PURE__*/React.createElement("thead", null, /*#__PURE__*/React.createElement("tr", null, /*#__PURE__*/React.createElement("th", null, this.props.txt('Path')))), /*#__PURE__*/React.createElement("tbody", null, filesInPage.map((file, index) => {
return /*#__PURE__*/React.createElement("tr", {
key: file
}, /*#__PURE__*/React.createElement("td", null, file));
@@ -1435,7 +1487,7 @@ class PreloadedFiles extends React.Component {
}
if (this.props.allFiles.length === 0) {
- return /*#__PURE__*/React.createElement("p", null, "No files have been preloaded ", /*#__PURE__*/React.createElement("i", null, "opcache.preload"));
+ return /*#__PURE__*/React.createElement("p", null, this.props.txt('No files have been preloaded opcache.preload'));
}
const {
@@ -1444,15 +1496,16 @@ class PreloadedFiles extends React.Component {
const offset = (currentPage - 1) * this.props.perPageLimit;
const filesInPage = this.doPagination ? this.props.allFiles.slice(offset, offset + this.props.perPageLimit) : this.props.allFiles;
const allFilesTotal = this.props.allFiles.length;
- return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("h3", null, allFilesTotal, " preloaded files"), this.doPagination && /*#__PURE__*/React.createElement(Pagination, {
+ return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("h3", null, this.props.txt('{0} preloaded files', allFilesTotal)), this.doPagination && /*#__PURE__*/React.createElement(Pagination, {
totalRecords: allFilesTotal,
pageLimit: this.props.perPageLimit,
pageNeighbours: 2,
onPageChanged: this.onPageChanged,
- refresh: this.state.refreshPagination
+ refresh: this.state.refreshPagination,
+ txt: this.props.txt
}), /*#__PURE__*/React.createElement("table", {
className: "tables preload-list-table"
- }, /*#__PURE__*/React.createElement("thead", null, /*#__PURE__*/React.createElement("tr", null, /*#__PURE__*/React.createElement("th", null, "Path"))), /*#__PURE__*/React.createElement("tbody", null, filesInPage.map((file, index) => {
+ }, /*#__PURE__*/React.createElement("thead", null, /*#__PURE__*/React.createElement("tr", null, /*#__PURE__*/React.createElement("th", null, this.props.txt('Path')))), /*#__PURE__*/React.createElement("tbody", null, filesInPage.map((file, index) => {
return /*#__PURE__*/React.createElement("tr", {
key: file
}, /*#__PURE__*/React.createElement("td", null, file));
@@ -1595,24 +1648,24 @@ class Pagination extends React.Component {
}, /*#__PURE__*/React.createElement("a", {
className: "page-link",
href: "#",
- "aria-label": "Previous",
+ "aria-label": this.props.txt('Previous'),
onClick: this.handleJumpLeft
}, /*#__PURE__*/React.createElement("span", {
"aria-hidden": "true"
}, "\u219E"), /*#__PURE__*/React.createElement("span", {
className: "sr-only"
- }, "Jump back"))), /*#__PURE__*/React.createElement("li", {
+ }, this.props.txt('Jump back')))), /*#__PURE__*/React.createElement("li", {
className: "page-item arrow"
}, /*#__PURE__*/React.createElement("a", {
className: "page-link",
href: "#",
- "aria-label": "Previous",
+ "aria-label": this.props.txt('Previous'),
onClick: this.handleMoveLeft
}, /*#__PURE__*/React.createElement("span", {
"aria-hidden": "true"
}, "\u21E0"), /*#__PURE__*/React.createElement("span", {
className: "sr-only"
- }, "Previous page"))));
+ }, this.props.txt('Previous page')))));
}
if (page === "RIGHT") {
@@ -1623,24 +1676,24 @@ class Pagination extends React.Component {
}, /*#__PURE__*/React.createElement("a", {
className: "page-link",
href: "#",
- "aria-label": "Next",
+ "aria-label": this.props.txt('Next'),
onClick: this.handleMoveRight
}, /*#__PURE__*/React.createElement("span", {
"aria-hidden": "true"
}, "\u21E2"), /*#__PURE__*/React.createElement("span", {
className: "sr-only"
- }, "Next page"))), /*#__PURE__*/React.createElement("li", {
+ }, this.props.txt('Next page')))), /*#__PURE__*/React.createElement("li", {
className: "page-item arrow"
}, /*#__PURE__*/React.createElement("a", {
className: "page-link",
href: "#",
- "aria-label": "Next",
+ "aria-label": this.props.txt('Next'),
onClick: this.handleJumpRight
}, /*#__PURE__*/React.createElement("span", {
"aria-hidden": "true"
}, "\u21A0"), /*#__PURE__*/React.createElement("span", {
className: "sr-only"
- }, "Jump forward"))));
+ }, this.props.txt('Jump forward')))));
}
return /*#__PURE__*/React.createElement("li", {
@@ -1708,7 +1761,8 @@ function debounce(func, wait, immediate) {
highlight: = json_encode($opcache->getOption('highlight')); ?>,
debounceRate: = $opcache->getOption('debounce_rate'); ?>,
perPageLimit: = json_encode($opcache->getOption('per_page')); ?>,
- realtimeRefresh: = json_encode($opcache->getOption('refresh_time')); ?>
+ realtimeRefresh: = json_encode($opcache->getOption('refresh_time')); ?>,
+ language: = json_encode($opcache->getOption('language_pack')); ?>,
}), document.getElementById('interface'));
diff --git a/src/Opcache/Service.php b/src/Opcache/Service.php
index 7ef7e1d..c31da53 100644
--- a/src/Opcache/Service.php
+++ b/src/Opcache/Service.php
@@ -50,6 +50,12 @@ class Service
*/
public function __construct(array $options = [])
{
+ $this->options = array_merge($this->defaults, $options);
+ $this->tz = new DateTimeZone(date_default_timezone_get());
+ if (is_string($this->options['language_pack'])) {
+ $this->options['language_pack'] = json_decode($this->options['language_pack'], true);
+ }
+
$this->optimizationLevels = [
1 << 0 => $this->txt('CSE, STRING construction'),
1 << 1 => $this->txt('Constant conversion and jumps'),
@@ -107,8 +113,6 @@ class Service
]
]
];
- $this->options = array_merge($this->defaults, $options);
- $this->tz = new DateTimeZone(date_default_timezone_get());
$this->data = $this->compileState();
}
@@ -120,7 +124,7 @@ class Service
{
$args = func_get_args();
$text = array_shift($args);
- if ((($lang = $this->getOption('language')) !== null) && !empty($lang[$text])) {
+ if ((($lang = $this->getOption('language_pack')) !== null) && !empty($lang[$text])) {
$text = $lang[$text];
}
foreach ($args as $i => $arg) {