This file is indexed.

/usr/share/doc/cockpit/guide/cockpit-locale.html is in cockpit-doc 164-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>cockpit.js: Localization</title>
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
<link rel="home" href="index.html" title="Cockpit Guide">
<link rel="up" href="api-base1.html" title="API: base1">
<link rel="prev" href="cockpit-location.html" title="cockpit.js: Page Location and Jumping">
<link rel="next" href="cockpit-error.html" title="cockpit.js: Errors">
<link rel="stylesheet" href="style.css" type="text/css">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2"><tr valign="middle">
<td><a accesskey="p" href="cockpit-location.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td>
<td><a accesskey="u" href="api-base1.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td>
<td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td>
<th width="100%" align="center">Cockpit Guide</th>
<td><a accesskey="n" href="cockpit-error.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td>
</tr></table>
<div class="refentry">
<a name="cockpit-locale"></a><div class="titlepage"></div>
<div class="refnamediv"><table width="100%"><tr>
<td valign="top">
<h2>cockpit.js: Localization</h2>
<p>cockpit.js: Localization — Localization and translations</p>
</td>
<td valign="top" align="right"></td>
</tr></table></div>
<div class="refsynopsisdiv">
<h2>Synopsis</h2>
<p>Cockpit provides a
    <a class="ulink" href="https://www.gnu.org/software/gettext/" target="_top"><code class="code">gettext()</code></a> like
    API for easy translation of strings.</p>
</div>
<div class="refsection">
<a name="cockpit-locale-language"></a><h2>cockpit.language</h2>
<p>The current locale language code. This is set based on the
      <a class="link" href="cockpit-locale.html#cockpit-locale-locale" title="cockpit.locale()"><code class="code">cockpit.locale()</code></a> data loaded.</p>
</div>
<div class="refsection">
<a name="cockpit-locale-locale"></a><h2>cockpit.locale()</h2>
<pre class="programlisting">
cockpit.locale(po)
</pre>
<p>Load locale information for a given <code class="code">po</code> data. The data should
      be JSON data in the <a class="ulink" href="https://www.npmjs.org/package/po2json" target="_top">po2json</a>
      format. The data will be loaded globally. If <code class="code">po</code> data has already been
      loaded, then this will extend that loaded data with additional strings. Any identical
      translations strings will be replaced with the new strings. A <code class="code">null</code> argument
      clears all the locale information previously loaded.</p>
<p>Various methods such as
      <a class="link" href="cockpit-locale.html#cockpit-locale-gettext" title="cockpit.gettext()"><code class="code">cockpit.gettext()</code></a> make use
      of the loaded data.</p>
</div>
<div class="refsection">
<a name="cockpit-locale-gettext"></a><h2>cockpit.gettext()</h2>
<pre class="programlisting">
translated = cockpit.gettext([context], string)
var _ = cockpit.gettext
var C_ = cockpit.gettext
translated = _("string")
translated = C_("context", "string")
</pre>
<p>Lookup <code class="code">string</code> for translation in the loaded locale data. The translated string will
      be returned, or <code class="code">string</code> will be returned if no such translated string is
      present. The <code class="code">context</code> argument is an optional string used to qualify the
      string.</p>
<p>This function can be assigned to a variable called <code class="code">_</code> (underscore) which
      will make your code work with the typical <code class="code">_("string")</code> syntax.</p>
</div>
<div class="refsection">
<a name="cockpit-locale-noop"></a><h2>cockpit.noop()</h2>
<pre class="programlisting">
var N_ = cockpit.noop
var NC_ = cockpit.noop
</pre>
<p>A noop function suitable for assigning to <code class="code">N_</code> or <code class="code">NC_</code> so that
      gettext scanners will be able to find translatable strings. More specifically this function
      returns its last argument.</p>
</div>
<div class="refsection">
<a name="cockpit-locale-ngettext"></a><h2>cockpit.ngettext()</h2>
<pre class="programlisting">
translated = cockpit.ngettext([context], string1, stringN, number)
</pre>
<p>Lookup a string appropriate for a pluralization form of the <code class="code">number</code>.
      Various languages have complex pluralization forms that go far between the singular
      and plural forms speakers of English are familiar with. If no such translated
      string is found then either one of <code class="code">string1</code> or <code class="code">stringN</code> is
      returned according to simple pluralization rules.</p>
<p>The <code class="code">context</code> argument is an optional string used to qualify the string.</p>
</div>
<div class="refsection">
<a name="cockpit-locale-translate"></a><h2>cockpit.translate()</h2>
<pre class="programlisting">
cockpit.translate()
cockpit.translate(element, ...)
cockpit.translate(selection)
</pre>
<p>The document will be scanned for <code class="code">translate</code> tags and they will be translated according
      to the strings in loaded locale data. One or more <code class="code">element</code> arguments may be specified.
      These are DOM elements for specific parts of the document to be translated. If no <code class="code">element</code>
      is specified then the entire document is translated.</p>
<p>If an array or array-like object is passed as a <code class="code">selection</code> then all DOM elements
      in the array will be treated as parts of the document to be translated.</p>
</div>
</div>
<div class="footer"><hr></div>
</body>
</html>