Skip to content

Commit

Permalink
Merge pull request #9505 from rebecca-shoptaw/9486/fix/basic-i18n-syn…
Browse files Browse the repository at this point in the history
…tax-additions

Basic `i18n` syntax additions
  • Loading branch information
cdrini authored Jul 17, 2024
2 parents 301aadc + 6157e42 commit 707e375
Show file tree
Hide file tree
Showing 69 changed files with 748 additions and 392 deletions.
628 changes: 556 additions & 72 deletions openlibrary/i18n/messages.pot

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions openlibrary/macros/FulltextSnippet.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
</section>

$if availability.get('status') == 'open':
<p class="center"><a href="https://archive.org/stream/$(ia)?ref=ol&access=1#search/$(q)">See All Results</a></p>
<p class="center"><a href="https://archive.org/stream/$(ia)?ref=ol&access=1#search/$(q)">$_("See All Results")</a></p>

$if availability.get('status') == 'borrow_available':
<p class="center">Borrow &amp; <a href="https://archive.org/stream/$(ia)?ref=ol&access=1#search/$(q)">See All Results</a></p>
<p class="center">$_("Borrow") &amp; <a href="https://archive.org/stream/$(ia)?ref=ol&access=1#search/$(q)">$_("See All Results")</a></p>
2 changes: 1 addition & 1 deletion openlibrary/macros/QueryCarousel.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<input type="hidden" name="q" value="$query"/>
$if has_fulltext_only:
<input type="hidden" name="has_fulltext" value="true"/>
<input type="text" placeholder="Search collection" name="q2"/>
<input type="text" placeholder="$_('Search collection')" name="q2"/>
<input type="submit"/>
</form>

Expand Down
2 changes: 1 addition & 1 deletion openlibrary/macros/RecentChangesAdmin.html
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
</tr>
$else:
<tr>
<td colspan="4" class="comment"><em>No edit history available.</em></td>
<td colspan="4" class="comment"><em>$_("No edit history available.")</em></td>
</tr>
</tbody>

Expand Down
2 changes: 1 addition & 1 deletion openlibrary/macros/RecentChangesUsers.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
$ show_users = (query_param('show_users', 'false').lower() == 'true')

$if len(changes) > 1:
<h2>Recent Activity</h2>
<h2>$_("Recent Activity")</h2>
<table class="changeHistory" style="width:100%;">
<thead>
<tr>
Expand Down
57 changes: 0 additions & 57 deletions openlibrary/macros/SearchResults.html

This file was deleted.

2 changes: 1 addition & 1 deletion openlibrary/macros/WorkInfo.html
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
$if this_lang:
<span class="tag">$this_lang.lang: <a href="$this_lang.url">$(this_lang.title or this_lang.url)</a></span>
$else:
<span class="tag">No link to Wikipedia in your language</span>
<span class="tag">$_("No link to Wikipedia in your language")</span>
$if simple:
<span class="tag">
Simple English: <a href="$simple.url">$(simple.title or simple.url)</a>
Expand Down
2 changes: 1 addition & 1 deletion openlibrary/templates/admin/attach_debugger.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
$def with (python_version, keys="", error="")

$var title: Attach Debugger
$var title: $_("Attach Debugger")

<div id="contentHead">
$:render_template("admin/menu")
Expand Down
14 changes: 7 additions & 7 deletions openlibrary/templates/admin/graphs.html
Original file line number Diff line number Diff line change
@@ -1,34 +1,34 @@

$var title: Performance Graphs
$var title: $_("Performance Graphs")

<div id="contentHead">
$:render_template("admin/menu")
<h1>Performance Graphs</h1>
<h1>$_("Performance Graphs")</h1>
</div>

$def render_graph_page(days):
$ defaults = {"width": 850, "height": 303, "from": days, "yMin": 0}

<h2>Number of Hits</h2>
<h2>$_("Number of Hits")</h2>
$ g = GraphiteGraph()
$g.add("stats.timers.ol.total.count").apply("movingAverage", 20).alias("#hits")
$:g.render(**defaults)

<h2>Page Load Times</h2>
<h2>$_("Page Load Times")</h2>
$ g = GraphiteGraph()
$g.add("stats.timers.ol.pageload.all.mean").apply("movingAverage", 20).alias("all")
$g.add("stats.timers.ol.pageload.all.loggedin.mean").apply("movingAverage", 20).alias("logged-in")
$g.add("stats.timers.ol.pageload.all.not_loggedin.mean").apply("movingAverage", 20).alias("not logged-in")
$:g.render(yLimit=100, **defaults)

<h2>Page Load Times Split</h2>
<h2>$_("Page Load Times Split")</h2>

$ g = GraphiteGraph()
$for name in ["authors", "books", "works", "home", "search", "subjects"]:
$g.add("stats.timers.ol.pageload.%s.mean" % name).apply("movingAverage", 20).alias(name)
$:g.render(yLimit=100, **defaults)

<h2>Infobase Mean</h2>
<h2>$_("Infobase Mean")</h2>
$ g = GraphiteGraph()
$g.add("stats.timers.ol.infobase.mean").apply("movingAverage", 20).alias("infobase.mean")
$:g.render(yLimit=300, **defaults)
Expand All @@ -38,7 +38,7 @@ <h2>Infobase Mean</h2>
<ul>
<li><a href="#day" id="link_day">$_("Today")</a></li>
<li><a href="#week" id="link_week">$_("This Week")</a></li>
<li><a href="#month" id="link_month">$("This Month")</a></li>
<li><a href="#month" id="link_month">$_("This Month")</a></li>
</ul>
<div id="day">$:render_graph_page("-1days")</div>
<div id="week">$:render_graph_page("-7days")</div>
Expand Down
8 changes: 4 additions & 4 deletions openlibrary/templates/admin/history.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
<table id="adminHistory" style="width: 100%">
<thead>
<tr>
<th><strong>Date</strong></th>
<th><strong>Who</strong></th>
<th><strong>Page</strong></th>
<th><strong>Comment</strong></th>
<th><strong>$_("Date")</strong></th>
<th><strong>$_("Who")</strong></th>
<th><strong>$_("Page")</strong></th>
<th><strong>$_("Comment")</strong></th>
</tr>
</thead>
<tbody>
Expand Down
2 changes: 1 addition & 1 deletion openlibrary/templates/admin/imports-add.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
$def with ()
$var title: Imports
$var title: $_("Imports")

<div id="contentHead">
$:render_template("admin/menu")
Expand Down
2 changes: 1 addition & 1 deletion openlibrary/templates/admin/imports.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
$def with (stats)
$var title: Imports
$var title: $_("Imports")

$ recache = query_param('recache', False)

Expand Down
32 changes: 16 additions & 16 deletions openlibrary/templates/admin/imports_by_date.html
Original file line number Diff line number Diff line change
@@ -1,34 +1,34 @@
$def with (stats, date)
$var title: Imports / $date
$var title: $_("Imports") / $date

<div id="contentHead">
$:render_template("admin/menu")
<h1><a href="/admin/imports">Imports</a> / $date</h1>
<h1><a href="/admin/imports">$_("Imports")</a> / $date</h1>

<h2>Summary</h2>
<h2>$_("Summary")</h2>
$ summary = stats.get_items_summary(date)

<table class="changeHistory" style="width: 300px;">
<tr><td>Total</td><td>$sum(summary['counts'].values())</td></tr>
<tr><td>Created</td><td>$summary['counts'].get('created', 0)</td></tr>
<tr><td>Found</td><td>$summary['counts'].get('found', 0)</td></tr>
<tr><td>Modified</td><td>$summary['counts'].get('modified', 0)</td></tr>
<tr><td>Failed</td><td>$summary['counts'].get('failed', 0)</td></tr>
<tr><td>Pending</td><td>$summary['counts'].get('pending', 0)</td></tr>
<tr><td>$_("Total")</td><td>$sum(summary['counts'].values())</td></tr>
<tr><td>$_("Created")</td><td>$summary['counts'].get('created', 0)</td></tr>
<tr><td>$_("Found")</td><td>$summary['counts'].get('found', 0)</td></tr>
<tr><td>$_("Modified")</td><td>$summary['counts'].get('modified', 0)</td></tr>
<tr><td>$_("Failed")</td><td>$summary['counts'].get('failed', 0)</td></tr>
<tr><td>$_("Pending")</td><td>$summary['counts'].get('pending', 0)</td></tr>
</table>

<h2>Items</h2>
<h2>$_("Items")</h2>

<div id="contentBody">
<table class="changeHistory">
<tr>
<th>#</th>
<th>Identifier</th>
<th>OL Key</th>
<th>Status</th>
<th>Error</th>
<th>Added Time</th>
<th>Imported Time</th>
<th>$_("Identifier")</th>
<th>$_("OL Key")</th>
<th>$_("Status")</th>
<th>$_("Error")</th>
<th>$_("Added Time")</th>
<th>$_("Imported Time")</th>
</tr>
$for row in stats.get_items(date):
<tr>
Expand Down
2 changes: 1 addition & 1 deletion openlibrary/templates/admin/inspect/memcache.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
$def with (keys, mapping)

$var title: [Admin Center] Inspect Memcache
$var title: $_("[Admin Center] Inspect Memcache")

<div id="contentHead">
$:render_template("admin/menu")
Expand Down
28 changes: 14 additions & 14 deletions openlibrary/templates/admin/inspect/store.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
$def with (docs, input={})

$var title: Admin Center / Inspect
$var title: $_("Admin Center / Inspect")

<style type="text/css">
tr {
Expand Down Expand Up @@ -35,48 +35,48 @@

<div id="contentHead">
$:render_template("admin/menu")
<h1>Inspect Store</h1>
<h1>$_("Inspect Store")</h1>
</div>

<div id="contentBody">

<div>
<h3>Get</h3>
<h3>$_("Get")</h3>
<form name="by_key" class="olform">
Key <input type="text" name="key" value="$input.get('key')"> <button type="submit">Submit</button>
$_("Key") <input type="text" name="key" value="$input.get('key')"> <button type="submit">$_("Submit")</button>
</form>
</div>

<div>
<h3>Query</h3>
<h3>$_("Query")</h3>
<form name="by_type" class="olform">
<table class="query">
<tr>
<td>Type</td>
<td>Name</td>
<td colspan="2">Value</td>
<td>$_("Type")</td>
<td>$_("Name")</td>
<td colspan="2">$_("Value")</td>
</tr>
<tr>
<td><input type="text" id="type" name="type" value="$input.get('type')"></td>
<td><input type="text" id="name" name="name" value="$input.get('name')"></td>
<td><input type="text" id="value" name="value" value="$input.get('value')"></td>
<td><button type="submit">Submit</button></td>
<td><button type="submit">$_("Submit")</button></td>
</tr>
</table>
</form>
</div>



<h3>Documents</h3>
<h3>$_("Documents")</h3>

<div>
$if docs:
<table class="meta">
<tr>
<th>Key</th>
<th>Type</th>
<th>Json</th>
<th>$_("Key")</th>
<th>$_("Type")</th>
<th>$_("Json")</th>
</tr>
$for doc in docs:
<tr>
Expand All @@ -86,7 +86,7 @@ <h3>Documents</h3>
</tr>
</table>
$else:
<em>No results found.</em>
<em>$_("No results found.")</em>
</div>

</div>
24 changes: 12 additions & 12 deletions openlibrary/templates/admin/ip/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
$ _x = ctx.setdefault('cssfile', 'admin')
$ _x = ctx.setdefault('usergroup', 'admin')

$var title: [Admin Center] IP Addresses
$var title: $_("[Admin Center] IP Addresses")

<div id="contentHead">
$:render_template("admin/menu")
<h1>IP Addresses</h1>
<h1>$_("IP Addresses")</h1>
</div>

<div id="contentBody">
Expand All @@ -17,27 +17,27 @@ <h2>$_("List of Banned IPs")</h2>
<tr>
<th>$_("Date/Time")</th>
<th>$_("IP address")</th>
<th>Admin Comment</th>
<th>$_("Admin Comment")</th>
<th>&nbsp;</th>
<th>$_("# of edits")</th>
</tr>
</thead>
<tr>
<td class="time">x minutes ago</td>
<td class="displayname"><a href="#">IP</a></td>
<td class="path" colspan="2">comment</td>
<td class="time">$_("x minutes ago")</td>
<td class="displayname"><a href="#">$_("IP")</a></td>
<td class="path" colspan="2">$_("comment")</td>
<td class="comment">###</td>
</tr>
<tr>
<td class="time">x minutes ago</td>
<td class="displayname"><a href="#">IP</a></td>
<td class="path" colspan="2">comment</td>
<td class="time">$_("x minutes ago")</td>
<td class="displayname"><a href="#">$_("IP")</a></td>
<td class="path" colspan="2">$_("comment")</td>
<td class="comment">###</td>
</tr>
<tr>
<td class="time">x minutes ago</td>
<td class="displayname"><a href="#">IP</a></td>
<td class="path" colspan="2">comment</td>
<td class="time">$_("x minutes ago")</td>
<td class="displayname"><a href="#">$_("IP")</a></td>
<td class="path" colspan="2">$_("comment")</td>
<td class="comment">###</td>
</tr>
</table>
Expand Down
2 changes: 1 addition & 1 deletion openlibrary/templates/admin/ip/view.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
$def with (ip)

$var title: [Admin Center] $ip
$var title: $_("[Admin Center]") $ip

<div id="contentHead">
$:render_template("admin/menu")
Expand Down
Loading

0 comments on commit 707e375

Please sign in to comment.