# 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
<!DOCTYPE html>
<html>
<head>
- <title>Opportunity - The meetup planner</title>
+ <title>{{{"Opportunity - The meetup planner"}}}</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">
<nav class="menu" role="navigation">
<div class="container">
<div class="navbar-header">
- <a class="navbar-brand" href="./" >Opportunity</a>
+ <a class="navbar-brand" href="./" >{{{"Opportunity"}}}</a>
</div>
</div>
</nav>
<div class="container">
"""
end
-
end
# Footer for a Opportunity page
<div class="footer">
<div class="well well-sm">
<p class="text-muted text-center">
- Opportunity, the meetup planner.
+ {{{"Opportunity, the meetup planner."}}}
</p>
<p class="text-muted text-center">
- Proudly powered by <a href="http://nitlanguage.org/">Nit</a>!
+ {{{"Proudly powered by %1!".format("<a href=\"http://nitlanguage.org/\">Nit</a>")}}}
</p>
</div>
</div>
</html>
"""
end
-
end
# Any Opportunity page that contains the header, body and footer.
# limitations under the License
# Shows a meetup and allows to modify its participants
-module meetup
+module meetup is i18n
import opportunity_model
import boilerplate
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();
<center><h1>{{{name}}}</h1></center>
"""
if not date.is_empty then t.add """
- <center><h4>When: {{{date}}}</h4></center>"""
+ <center><h4>{{{"When:"}}} {{{date}}}</h4></center>"""
if not place.is_empty then t.add """
- <center><h4>Where: {{{place}}}</h4></center>"""
+ <center><h4>{{{"Where:"}}} {{{place}}}</h4></center>"""
t.add """
</div>
<table class="table">
"""
- t.add "<th>Participant name</th>"
+ t.add "<th>{"Participant name"}</th>"
for i in answers(db) do
t.add "<th class=\"text-center\">"
t.add i.to_s
end
t.add "</center></td>"
end
- t.add """<td class="opportunity-action"><center><button class="btn btn-xs btn-warning" type="button" onclick="modify_people(this, {{{i.id}}})" id="modify_{{{i.id}}}">Modify or delete</button> """
- t.add """<button class="btn btn-xs btn-danger" type="button" onclick="remove_people(this)" id="delete_{{{i.id}}}" style="display: none;">Delete</button></center></td>"""
+ t.add """<td class="opportunity-action"><center><button class="btn btn-xs btn-warning" type="button" onclick="modify_people(this, {{{i.id}}})" id="modify_{{{i.id}}}">{{{"Modify or delete"}}}</button> """
+ t.add """<button class="btn btn-xs btn-danger" type="button" onclick="remove_people(this)" id="delete_{{{i.id}}}" style="display: none;">{{{"Delete"}}}</button></center></td>"""
t.add "</tr>"
end
t.add """
<tr id="newrow" style="background-color: LightYellow">
- <td><input id="new_name" type="text" placeholder="Your name" class="input-large"></td>
+ <td><input id="new_name" type="text" placeholder="{{{"Your name"}}}" class="input-large"></td>
"""
for i in answers(db) do
t.add "<td class=\"answer\" id=\"newans_{i.id}\" onclick=\"change_temp_answer(this)\" style=\"color:red;\"><center>✘</center></td>"
end
t.add """
- <td><center><span id="add_{{{id}}}" onclick="add_part(this)" style="color:green;" class="action"><button class="btn btn-xs btn-success" type="button">Done</button></span></center></td>"""
+ <td><center><span id="add_{{{id}}}" onclick="add_part(this)" style="color:green;" class="action"><button class="btn btn-xs btn-success" type="button">{{{"Done"}}}</button></span></center></td>"""
t.add "</tr>"
# Compute score for each answer
var scores = new HashMap[Int, Int]
# 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
init do
body = """
<div class="page-header">
- <center><h1>Your meetup was successfully created</h1></center>
+ <center><h1>{{{"Your meetup was successfully created"}}}</h1></center>
</div>
<div class="container">
<div class="alert alert-success text-center" role="alert">
- Invite participants by sharing this link: <a href="./?meetup_id={{{meetup.id}}}">{{{meetup.name}}}</a>
+ {{{"Invite participants by sharing this link:"}}} <a href="./?meetup_id={{{meetup.id}}}">{{{meetup.name}}}</a>
</div>
<p class="text-center">
- See you soon for more Opportunities!
+ {{{"See you soon for more Opportunities!"}}}
</p>
</div>
"""
# 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
ansdiv.append('<div class="form-group">' +
'<label for="answer_' + nb + '" class="col-sm-4 control-label">' + nb + '</label>' +
'<div class="col-sm-8">' +
- '<input name="answer_' + nb + '" id="answer_' + nb + '" class="form-control" type="text" placeholder="Another opportunity">' +
+ '<input name="answer_' + nb + '" id="answer_' + nb + '" class="form-control" type="text" placeholder="{{{"Another opportunity"}}}">' +
'</div></div>')
}
"""
if error != null then
bdy.add "<p></p>"
bdy.add """<div class="alert alert-danger alert-dismissible" role="alert">
- <button type="button" class="close" data-dismiss="alert"><span aria-hidden="true">×</span><span class="sr-only">Close</span></button>
+ <button type="button" class="close" data-dismiss="alert"><span aria-hidden="true">×</span><span class="sr-only">{{{"Close"}}}</span></button>
"""
bdy.add error.as(not null)
bdy.add "</div>"
bdy.add """
<div class="page-header">
- <center><h1>Create a meetup</h1></center>
+ <center><h1>{{{"Create a meetup"}}}</h1></center>
</div>
"""
bdy.add """<form class="form-horizontal" action="meetup_create" method="POST" role="form">
<div class = "form-group">
- <label for="meetup_name" class="col-sm-4 control-label">Meetup name</label>
+ <label for="meetup_name" class="col-sm-4 control-label">{{{"Meetup name"}}}</label>
<div class="col-sm-8">
- <input name="meetup_name" id="meetup_name" type="text" class="form-control" placeholder="My Event" value="{{{if meet != null then meet.name else ""}}}" />
+ <input name="meetup_name" id="meetup_name" type="text" class="form-control" placeholder="{{{"My Event"}}}" value="{{{if meet != null then meet.name else ""}}}" />
</div>
</div>
<div class = "form-group">
- <label for="meetup_date" class="col-sm-4 control-label">When?</label>
+ <label for="meetup_date" class="col-sm-4 control-label">{{{"When?"}}}</label>
<div class="col-sm-8">
- <input name="meetup_date" id="meetup_date" type="text" class="form-control" placeholder="Time of the event" value="{{{if meet != null then meet.date else ""}}}">
+ <input name="meetup_date" id="meetup_date" type="text" class="form-control" placeholder="{{{"Time of the event"}}}" value="{{{if meet != null then meet.date else ""}}}">
</div>
</div>
<div class = "form-group">
- <label for="meetup=place" class="col-sm-4 control-label">Where?</label>
+ <label for="meetup=place" class="col-sm-4 control-label">{{{"Where?"}}}</label>
<div class="col-sm-8">
- <input name="meetup_place" id="meetup_place" type="text" class="form-control" placeholder="Place of the event" value="{{{if meet != null then meet.place else ""}}}">
+ <input name="meetup_place" id="meetup_place" type="text" class="form-control" placeholder="{{{"Place of the event"}}}" value="{{{if meet != null then meet.place else ""}}}">
</div>
</div>
<div class = "form-group">
- <label for="meetup=maybe" class="col-sm-4 control-label">Add a Maybe option?</label>
+ <label for="meetup=maybe" class="col-sm-4 control-label">{{{"Add a Maybe option?"}}}</label>
<div class="col-sm-8">
<input name="meetup_mode" id="meetup_mode" type="checkbox" class="form-control">
</div>
</div>
- <h2>Opportunities</h2>
+ <h2>{{{"Opportunities"}}}</h2>
<div id="answers">
"""
bdy.add """
</div>
<div class="form-group">
- <button type="button" class="btn btn-lg" onclick="new_answer(this)">Add an opportunity</button>
- <button type="submit" class="btn btn-lg btn-success">Create meetup</button>
+ <button type="button" class="btn btn-lg" onclick="new_answer(this)">{{{"Add an opportunity"}}}</button>
+ <button type="submit" class="btn btn-lg btn-success">{{{"Create meetup"}}}</button>
</div>
</form>
</center>
# limitations under the License
# Welcome page for Opportunity
-module welcome
+module welcome is i18n
import boilerplate
init do
body = """
<div class="page-header">
- <h1 class="text-center">Welcome to Opportunity!</h1>
+ <h1 class="text-center">{{{"Welcome to Opportunity!"}}}</h1>
</div>
<p class="text-center">
- <p class="text-center">Opportunity is a free (as in free software), easy-to-use, meetup planner.</p>
- <p class="text-center">You can start using it right now by creating a new Meetup and sharing it with your friends!</p>
+ <p class="text-center">{{{"Opportunity is a free (as in free software), easy-to-use, meetup planner."}}}</p>
+ <p class="text-center">{{{"You can start using it right now by creating a new Meetup and sharing it with your friends!"}}}</p>
<p class="text-center">
<form action="new_meetup">
- <button type="submit" class="btn btn-lg center-block btn-success">Create a Meetup</button>
+ <button type="submit" class="btn btn-lg center-block btn-success">{{{"Create a Meetup"}}}</button>
</form>
</p>
</p>
"""
end
-
end