Skip to content

Commit

Permalink
Added more improvements about i18n support #2
Browse files Browse the repository at this point in the history
  • Loading branch information
macagua committed Jan 7, 2020
1 parent d06c599 commit 5b0fb02
Show file tree
Hide file tree
Showing 9 changed files with 93 additions and 67 deletions.
13 changes: 5 additions & 8 deletions opencore/themes/avata/browser/explore-menu.pt
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<ul id="oc-usermenu-explore"
i18n:domain="opencore"
>
i18n:domain="opencore">
<li class="home">
<a tal:attributes="href context/portal_url"
i18n:translate="topnav_explore_home">Home</a>
Expand All @@ -14,19 +13,17 @@
<li>
<a tal:attributes="href string:${context/portal_url}/projects"
i18n:translate="topnav_explore_projects">
<i18n:setvar
i18n:name="project_noun"
tal:content="string:${view/project_noun/title}" />s
<i18n:setvar i18n:name="project_noun"
tal:content="string:${view/project_noun/title}" />s
</a>
</li>

<li>
<a tal:attributes="href string:${context/portal_url}/projects/create"
i18n:translate="topnav_explore_new_project">

Start a <i18n:setvar
i18n:name="project_noun"
tal:content="string:${view/project_noun/title}" />
Start a <i18n:setvar i18n:name="project_noun"
tal:content="string:${view/project_noun/title}" />
</a>
</li>
</ul>
11 changes: 8 additions & 3 deletions opencore/themes/avata/browser/get-started.pt
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,17 @@
</h3>
</li>
<li class="get-started-projects">
<h3><a tal:attributes="href string:${context/portal_url}/projects" i18n:translate="get_started_project_search">
Find <span i18n:name="project_noun" tal:replace="view/project_noun">project</span>s</a>
<h3>
<a tal:attributes="href string:${context/portal_url}/projects" i18n:translate="get_started_project_search">
Find <span i18n:name="project_noun" tal:replace="view/project_noun">project</span>s
</a>
</h3>
</li>
<li class="get-started-people">
<h3><a tal:attributes="href string:${context/portal_url}/people" i18n:translate="get_started_people_search">Find people</a></h3>
<h3>
<a tal:attributes="href string:${context/portal_url}/people"
i18n:translate="get_started_people_search">Find people</a>
</h3>
</li>
</ul>
</div>
29 changes: 14 additions & 15 deletions opencore/themes/avata/browser/home.pt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
free project management tools, wikis, blogs, mailing lists and task
tracking for neighborhood and global communities.
</title>

<metal:script fill-slot="meta">
<meta name="keywords" content="free wikis, free mailing lists, free blogs, free task tracking, free project management" />
<meta name="description" tal:attributes="content string:${view/portal_title} offers free tools to help you build an online community and promote real-world change"/>
Expand Down Expand Up @@ -67,7 +66,7 @@
</h3>
<p class="oc-feed-item-data oc-discreetText" tal:define="nmembers python: view.n_project_members(project)">
<span tal:replace="nmembers">YY</span> <tal:i18n i18n:translate="">member</tal:i18n>
<span tal:condition="python: nmembers != 1" tal:replace="string:s" />
<span tal:condition="python: nmembers != 1" tal:replace="string:s" />
</p>
<p class="oc-feed-item-data oc-discreetText" i18n:translate="home_project_updated">
last updated <span i18n:name="project_updated" tal:replace="python: view.pretty_date(project.ModificationDate)">Jan 1937</span>
Expand All @@ -83,12 +82,11 @@
<tal:provider replace="structure provider:opencore.sidebar" />
<div id="oc-home-news" class="oc-widget oc-widget-feed">
<h2 class="oc-feed-title">
<a i18n:attributes="title News"
title="News"
href="news"
i18n:translate="news_section_heading">
<tal:dummy i18n:name="portal_title" tal:content="view/portal_title" /> News
</a>
<a href="news" title="News"
i18n:attributes="title News"
i18n:translate="news_section_heading">
<tal:dummy i18n:name="portal_title" tal:content="view/portal_title" /> News
</a>
</h2>
<ul class="oc-lineup-list">
<li tal:repeat="item view/news" class="oc-feed-item oc-clearAfter">
Expand All @@ -101,20 +99,20 @@
<div class="oc-feed-item-data oc-discreetText">
<tal:i18n i18n:translate="home_news_item_by">by</tal:i18n>
<a tal:define="userid item/Creator"
tal:attributes="href string:${context/portal_url}/people/${userid}"
tal:content="userid" />,
tal:attributes="href string:${context/portal_url}/people/${userid}"
tal:content="userid" />,
<span tal:replace="python: view.pretty_date(item.CreationDate)" />
</div>
<p class="oc-feed-item-description" tal:content="item/Description">
<tal:comment replace="nothing">The description is the comment for the news item, however long it is</tal:comment>
</p>
</li>
<li>
<a i18n:translate="home_news_more_link"
class="oc-paginator"
tal:attributes="href string:${context/portal_url}/news">
more news&hellip;
</a>
<a class="oc-paginator"
tal:attributes="href string:${context/portal_url}/news"
i18n:translate="home_news_more_link">
more news&hellip;
</a>
</li>
</ul>
</div><!-- CoActivate News -->
Expand All @@ -123,3 +121,4 @@
</div><!-- content-fill-slot -->
</body>
</html>

21 changes: 12 additions & 9 deletions opencore/themes/avata/browser/latest_activity.pt
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
<html metal:use-macro="here/@@standard_macros/master" i18n:domain="opencore">
<head>
<title metal:fill-slot="title"
tal:content="string:Summary - ${view/window_title}" />
<title i18n:translate="latest_activity_window_title" metal:fill-slot="title">
Summary - <span i18n:name="window_title" tal:replace="view/window_title" />
</title>
</head>
<body>
<div metal:fill-slot="content">
Expand All @@ -12,12 +13,12 @@
<p class="oc-headingContext oc-discreetText">
<tal:i18n i18n:translate="">created
<span tal:define="date context/CreationDate"
tal:content="python:view.pretty_date(date)" i18n:name="creation_date">
tal:content="python:view.pretty_date(date)" i18n:name="creation_date">
<tal:comment replace="nothing">September 26</tal:comment>
</span>,
last updated
<span tal:define="date context/ModificationDate"
tal:content="python:view.pretty_date(date)" i18n:name="modification_date">
tal:content="python:view.pretty_date(date)" i18n:name="modification_date">
<tal:comment replace="nothing">yesterday</tal:comment>
</span>
</tal:i18n>
Expand All @@ -30,14 +31,14 @@
</div>

<!-- feeds -->
<div class="oc-columnGroup">
<div class="oc-columnGroup">

<tal:feeds replace="structure provider:opencore.feed_summaries">
Rendering happens with viewlets in featurelet packages
</tal:feeds>

</div>
</div><!-- content-main -->
</div>
</div><!-- content-main -->

<div id="oc-content-sidebar">

Expand All @@ -49,8 +50,9 @@
</div>

<!-- display project security settings -->
<h2><tal:i18n i18n:translate="">Security</tal:i18n> <a class="oc-actionLink" tal:condition="view/team_manager" href="preferences"
i18n:translate="">EDIT</a></h2>
<h2>
<tal:i18n i18n:translate="">Security</tal:i18n> <a class="oc-actionLink" tal:condition="view/team_manager" href="preferences" i18n:translate="">EDIT</a>
</h2>
<p tal:condition="python:view.project_info['security'] == 'open_policy'" i18n:translate="">
Anyone can view this <span tal:replace="view/project_noun" i18n:name="project_noun">project</span> and
any <span tal:replace="view/portal_title" i18n:name="portal_title">site</span>
Expand All @@ -72,3 +74,4 @@
</div><!-- content-fill-slot -->
</body>
</html>

7 changes: 4 additions & 3 deletions opencore/themes/avata/browser/mystuff-menu.pt
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@
<li><hr class="oc-usermenu-divider" /></li>

<li>
<a i18n:translate="Profile"
<a i18n:translate="mystuff_menu_profile"
tal:attributes="href string:${memfolder_url}/profile">Profile</a>
</li>

<li>
<a i18n:translate="Wiki"
<a i18n:translate="mystuff_menu_wiki"
tal:attributes="href view/memhome_url">Wiki</a>
</li>

Expand All @@ -25,7 +25,7 @@
<a tal:define="msgs_str python:msgs != 1 and 'messages' or 'message'"
tal:attributes="href string:${memfolder_url}/account"
>
<tal:i18n i18n:translate="Account">Account</tal:i18n>
<tal:i18n i18n:translate="mystuff_menu_account">Account</tal:i18n>
<span class="oc-mystuff-messagecount"
tal:condition="has_msgs">
(<span id="num_updates_menu" tal:content="string:${msgs}" />
Expand All @@ -46,3 +46,4 @@

</tal:projects>
</ul>

8 changes: 6 additions & 2 deletions opencore/themes/avata/browser/topnav.pt
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@
tal:condition="not:piv/inProject" />
</h1>

<h2 tal:condition="python:not view.piv.inProject" id="tagline" i18n:translate="topnav_subhead">Do good, better. <span><span i18n:name="portal_title" tal:replace="view/portal_title">CoActivate</span> is a platform for social activism.</span></h2>
<h2 tal:condition="python:not view.piv.inProject" id="tagline" i18n:translate="topnav_subhead">
Do good, better. <span><span i18n:name="portal_title" tal:replace="view/portal_title">CoActivate</span> is a platform for social activism.</span>
</h2>

<tal:comment replace="nothing">
<!-- old topnav generation -->
Expand Down Expand Up @@ -48,7 +50,8 @@
accesskey="4" class="oc-input-typeText"
i18n:attributes="title topnav_site_search_label"
/>
<input class="button" name="searchsubmit" value="Find" tabindex="2" src="/++resource++img/search-button.png" align="middle" type="image" />
<input class="button" name="searchsubmit" value="Find" tabindex="2"
src="/++resource++img/search-button.png" align="middle" type="image" />
</form>
</div>

Expand All @@ -57,3 +60,4 @@
</div>

</div>

58 changes: 36 additions & 22 deletions opencore/themes/avata/browser/tour.pt
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,10 @@
<a tal:attributes="href string:${context/absolute_url}/project-home">
<img src="++resource++img/touricons/wiki.gif" class="oc-tour-icon" />
</a>
<h3><a tal:attributes="href string:${context/absolute_url}/project-home"
i18n:translate="project_tour_wiki">Wiki pages</a></h3>
<h3>
<a tal:attributes="href string:${context/absolute_url}/project-home"
i18n:translate="project_tour_wiki">Wiki pages</a>
</h3>
<ul class="oc-discreetText oc-plainList">
<li i18n:translate="project_tour_wiki_infodump">A blank canvas for key information</li>
<li i18n:translate="project_tour_wiki_collaborate">Write collaboratively</li>
Expand All @@ -38,8 +40,10 @@
<a tal:attributes="href string:${context/absolute_url}/blog">
<img src="++resource++img/touricons/blog.gif" class="oc-tour-icon" />
</a>
<h3><a tal:attributes="href string:${context/absolute_url}/blog"
i18n:translate="project_tour_blog">Blog</a></h3>
<h3>
<a tal:attributes="href string:${context/absolute_url}/blog"
i18n:translate="project_tour_blog">Blog</a>
</h3>
<ul class="oc-discreetText oc-plainList">
<li i18n:translate="project_tour_blog_publish">Publish updates</li>
<li i18n:translate="project_tour_blog_buzz">Attract attention</li>
Expand All @@ -52,14 +56,18 @@
<div class="oc-boxy">
<div class="oc-headingBlock oc-tour-feature-heading">
<h2 i18n:translate="project_tour_organize">Organize</h2>
<p class="oc-headingContext" i18n:translate="project_tour_organize_team">Keep your team organized and on-track.</p>
<p class="oc-headingContext"
i18n:translate="project_tour_organize_team">Keep your team organized and on-track.</p>
</div>

<div class="oc-tour-feature">
<a tal:attributes="href string:${context/absolute_url}/manage-team">
<img src="++resource++img/touricons/team.gif" class="oc-tour-icon" />
</a>
<h3 tal:attributes="href string:${context/absolute_url}/manage-team"><a tal:attributes="href string:${context/absolute_url}/manage-team" i18n:translate="project_tour_team">Manage your team</a></h3>
<h3 tal:attributes="href string:${context/absolute_url}/manage-team">
<a tal:attributes="href string:${context/absolute_url}/manage-team"
i18n:translate="project_tour_team">Manage your team</a>
</h3>
<ul class="oc-discreetText oc-plainList">
<li i18n:translate="project_tour_team_invite">Invite people to join this <span i18n:name="project_noun" tal:replace="view/project_noun" /></li>
<li i18n:translate="project_tour_team_invite_again">Build momentum</li>
Expand All @@ -71,8 +79,10 @@
<a tal:attributes="href string:${context/absolute_url}/lists">
<img src="++resource++img/touricons/mailinglist.gif" class="oc-tour-icon" />
</a>
<h3><a i18n:translate="project_tour_mailinglists"
tal:attributes="href string:${context/absolute_url}/lists">Mailing lists</a></h3>
<h3>
<a i18n:translate="project_tour_mailinglists"
tal:attributes="href string:${context/absolute_url}/lists">Mailing lists</a>
</h3>
<ul class="oc-discreetText oc-plainList">
<li i18n:translate="project_tour_mailinglists_update">Keep everyone up-to-date</li>
<li i18n:translate="project_tour_mailinglists_discuss">Promote discussions</li>
Expand All @@ -84,7 +94,10 @@
<a tal:attributes="href string:${context/absolute_url}/tasks">
<img src="++resource++img/touricons/tasks.gif" class="oc-tour-icon" />
</a>
<h3><a tal:attributes="href string:${context/absolute_url}/tasks" i18n:translate="project_tour_tasktracker">Task Tracker</a></h3>
<h3>
<a tal:attributes="href string:${context/absolute_url}/tasks"
i18n:translate="project_tour_tasktracker">Task Tracker</a>
</h3>
<ul class="oc-discreetText oc-plainList">
<li i18n:translate="project_tour_tasktracker_share">Share to-do lists</li>
<li i18n:translate="project_tour_tasktracker_delegate">Assign tasks to others</li>
Expand All @@ -97,22 +110,23 @@
</div><!-- end #oc-content-main -->

<div id="oc-content-sidebar">
<p class="oc-smallText" i18n:translate="project_tour_preferences"
tal:define="project_prefs_url string:${context/absolute_url}/preferences">
<!-- this is a hacky way to get the 'project_prefs_url' key into the i18n mapping,
so that it can be used in the anchor href below. i don't know of a cleaner
way to do this, unfortunately -->
<tal:comment i18n:name="project_prefs_url" replace="nothing">
<tal:dummy replace="project_prefs_url" />
</tal:comment>
<tal:i18n i18n:translate="project_tour_preferences_msg">
Want to add or remove tools from your <span tal:replace="view/project_noun" i18n:name="project_noun">project</span>?
Change your</tal:i18n> <a tal:attributes="href project_prefs_url" i18n:translate="project_prefs_url">preferences</a>.
</p>
<p class="oc-smallText" i18n:translate="project_tour_preferences"
tal:define="project_prefs_url string:${context/absolute_url}/preferences">
<!-- this is a hacky way to get the 'project_prefs_url' key into the i18n mapping,
so that it can be used in the anchor href below. i don't know of a cleaner
way to do this, unfortunately -->
<tal:comment i18n:name="project_prefs_url" replace="nothing">
<tal:dummy replace="project_prefs_url" />
</tal:comment>

<tal:i18n i18n:translate="project_tour_preferences_msg">
Want to add or remove tools from your <span tal:replace="view/project_noun" i18n:name="project_noun">project</span>?
Change your</tal:i18n> <a tal:attributes="href project_prefs_url" i18n:name="project_prefs" i18n:translate="project_preferences">preferences</a>.
</p>

</div><!-- end #oc-content-sidebar -->

</div><!-- content-fill-slot -->
</body>
</html>

1 change: 1 addition & 0 deletions opencore/themes/avata/browser/user-menu.pt
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,4 @@
</li>

</ul>

12 changes: 7 additions & 5 deletions opencore/themes/avata/locales/rebuild_i18n
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
#!/bin/sh

domain='opencore'

# Synchronise the templates and scripts with the .pot file for opencore domain.
i18ndude rebuild-pot --pot ./$domain.pot --create $domain ../
i18ndude rebuild-pot --pot ./$domain.pot --create $domain --exclude ../browser/extra_css.pt ../

# Synchronise the opencore's pot file (Used for the workflows)
i18ndude sync --pot ./$domain.pot ./*/LC_MESSAGES/$domain.po

WARNINGS=`find . -name "*pt" | xargs i18ndude find-untranslated | grep -e '^-WARN' | wc -l`
ERRORS=`find . -name "*pt" | xargs i18ndude find-untranslated | grep -e '^-ERROR' | wc -l`
FATAL=`find . -name "*pt" | xargs i18ndude find-untranslated | grep -e '^-FATAL' | wc -l`
WARNINGS=`find ../browser/{h*,exp*,u*,m*,l*,t*,g*}.pt -name "*pt" | xargs i18ndude find-untranslated | grep -e '^-WARN' | wc -l`
ERRORS=`find ../browser/{h*,exp*,u*,m*,l*,t*,g*}.pt -name "*pt" | xargs i18ndude find-untranslated | grep -e '^-ERROR' | wc -l`
FATAL=`find ../browser/{h*,exp*,u*,m*,l*,t*,g*}.pt -name "*pt" | xargs i18ndude find-untranslated | grep -e '^-FATAL' | wc -l`

echo
echo "There are $WARNINGS warnings \(possibly missing i18n markup\)"
Expand All @@ -21,4 +23,4 @@ rm ./rebuild_i18n.log

touch ./rebuild_i18n.log

find ../ -name "*pt" | xargs i18ndude find-untranslated > rebuild_i18n.log
find ../browser/{h*,exp*,u*,m*,l*,t*,g*}.pt -name "*pt" | xargs i18ndude find-untranslated > rebuild_i18n.log

0 comments on commit 5b0fb02

Please sign in to comment.