From 7be64e69613b4032c53848e9f72d87399e9c7094 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Alexis=20Laferri=C3=A8re?= Date: Fri, 19 Jun 2015 11:01:24 -0400 Subject: [PATCH] contrib/opportunity: prepare for i18n by separating the localized strings from the rest MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Alexis Laferrière --- contrib/opportunity/src/templates/boilerplate.nit | 13 +++++---- contrib/opportunity/src/templates/meetup.nit | 20 +++++++------- .../src/templates/meetup_confirmation.nit | 8 +++--- .../opportunity/src/templates/meetup_creation.nit | 28 ++++++++++---------- contrib/opportunity/src/templates/welcome.nit | 11 ++++---- 5 files changed, 39 insertions(+), 41 deletions(-) diff --git a/contrib/opportunity/src/templates/boilerplate.nit b/contrib/opportunity/src/templates/boilerplate.nit index a92ab4b..1a16449 100644 --- a/contrib/opportunity/src/templates/boilerplate.nit +++ b/contrib/opportunity/src/templates/boilerplate.nit @@ -13,9 +13,10 @@ # limitations under the License # Contains the main components of a webpage for Opportunity -module boilerplate +module boilerplate is i18n import template +import gettext # Header for a Opportunity page class OpportunityHeader @@ -29,7 +30,7 @@ class OpportunityHeader - Opportunity - The meetup planner + {{{"Opportunity - The meetup planner"}}} @@ -69,14 +70,13 @@ class OpportunityHeader
""" end - end # Footer for a Opportunity page @@ -89,10 +89,10 @@ class OpportunityFooter @@ -100,7 +100,6 @@ class OpportunityFooter """ end - end # Any Opportunity page that contains the header, body and footer. diff --git a/contrib/opportunity/src/templates/meetup.nit b/contrib/opportunity/src/templates/meetup.nit index 07a5f66..0358f33 100644 --- a/contrib/opportunity/src/templates/meetup.nit +++ b/contrib/opportunity/src/templates/meetup.nit @@ -13,7 +13,7 @@ # limitations under the License # Shows a meetup and allows to modify its participants -module meetup +module meetup is i18n import opportunity_model import boilerplate @@ -231,14 +231,14 @@ class OpportunityMeetupPage function modify_people(ele, id){ if (in_modification_id != null) { // reset to normal values - $('#modify_'+in_modification_id).text("Modify or delete"); + $('#modify_'+in_modification_id).text("{{{"Modify or delete"}}}"); $('#modify_'+in_modification_id).attr("class", "btn btn-xs btn-warning"); $('#line_'+in_modification_id).css("background-color", ""); $('#delete_'+in_modification_id).css("display", "none"); } if (in_modification_id != id) { // activate modifiable mode - $('#modify_'+id).text("Done"); + $('#modify_'+id).text("{{{"Done"}}}"); $('#modify_'+id).attr("class", "btn btn-xs btn-success"); $('#line_'+id).css("background-color", "LightYellow"); $('#delete_'+id).show(); @@ -274,16 +274,16 @@ redef class Meetup

{{{name}}}

""" if not date.is_empty then t.add """ -

When: {{{date}}}

""" +

{{{"When:"}}} {{{date}}}

""" if not place.is_empty then t.add """ -

Where: {{{place}}}

""" +

{{{"Where:"}}} {{{place}}}

""" t.add """
""" - t.add "" + t.add "" for i in answers(db) do t.add """" + t.add """""" t.add "" end t.add """ - + """ for i in answers(db) do t.add "" end t.add """ - """ + """ t.add "" # Compute score for each answer var scores = new HashMap[Int, Int] diff --git a/contrib/opportunity/src/templates/meetup_confirmation.nit b/contrib/opportunity/src/templates/meetup_confirmation.nit index 8771795..648f4da 100644 --- a/contrib/opportunity/src/templates/meetup_confirmation.nit +++ b/contrib/opportunity/src/templates/meetup_confirmation.nit @@ -13,7 +13,7 @@ # limitations under the License # Page to show when the creation of a Meetup is successful -module meetup_confirmation +module meetup_confirmation is i18n import boilerplate import opportunity_model @@ -27,14 +27,14 @@ class MeetupConfirmation init do body = """

- See you soon for more Opportunities! + {{{"See you soon for more Opportunities!"}}}

""" diff --git a/contrib/opportunity/src/templates/meetup_creation.nit b/contrib/opportunity/src/templates/meetup_creation.nit index 5b1a048..8c2ab3d 100644 --- a/contrib/opportunity/src/templates/meetup_creation.nit +++ b/contrib/opportunity/src/templates/meetup_creation.nit @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License -module meetup_creation +module meetup_creation is i18n import boilerplate import opportunity_model @@ -49,7 +49,7 @@ function new_answer(sender){ ansdiv.append('
' + '' + '
' + - '' + + '' + '
') } """ @@ -63,7 +63,7 @@ function new_answer(sender){ if error != null then bdy.add "

" bdy.add """" @@ -71,35 +71,35 @@ function new_answer(sender){ bdy.add """ """ bdy.add """
- +
- +
- +
- +
- +
- +
- +
-

Opportunities

+

{{{"Opportunities"}}}

""" @@ -139,8 +139,8 @@ function new_answer(sender){ bdy.add """
- - + +
diff --git a/contrib/opportunity/src/templates/welcome.nit b/contrib/opportunity/src/templates/welcome.nit index 08f7696..2d321da 100644 --- a/contrib/opportunity/src/templates/welcome.nit +++ b/contrib/opportunity/src/templates/welcome.nit @@ -13,7 +13,7 @@ # limitations under the License # Welcome page for Opportunity -module welcome +module welcome is i18n import boilerplate @@ -24,18 +24,17 @@ class OpportunityHomePage init do body = """

-

Opportunity is a free (as in free software), easy-to-use, meetup planner.

-

You can start using it right now by creating a new Meetup and sharing it with your friends!

+

{{{"Opportunity is a free (as in free software), easy-to-use, meetup planner."}}}

+

{{{"You can start using it right now by creating a new Meetup and sharing it with your friends!"}}}

- +

""" end - end -- 1.7.9.5
Participant name{"Participant name"}" t.add i.to_s @@ -333,19 +333,19 @@ redef class Meetup end t.add "" end - t.add """
 """ - t.add """
 """ + t.add """
✘