i18n of hats

This commit is contained in:
Carl Chenet 2017-05-19 13:32:21 +02:00
parent b74b9e3b94
commit 2aba955a68
6 changed files with 98 additions and 62 deletions

View file

@ -28,7 +28,7 @@ class HatsController < ApplicationController
@hat_request.comment = params[:hat_request][:comment]
if @hat_request.save
flash[:success] = "Successfully submitted hat request."
flash[:success] = t('.submittedhatrequest')
return redirect_to "/hats"
end
@ -47,7 +47,7 @@ class HatsController < ApplicationController
permit(:hat, :link))
@hat_request.approve_by_user!(@user)
flash[:success] = "Successfully approved hat request."
flash[:success] = t('.approvedhatrequest')
return redirect_to "/hats/requests"
end
@ -57,7 +57,7 @@ class HatsController < ApplicationController
@hat_request.reject_by_user_for_reason!(@user,
params[:hat_request][:rejection_comment])
flash[:success] = "Successfully rejected hat request."
flash[:success] = t('.rejectedhatrequest')
return redirect_to "/hats/requests"
end

View file

@ -1,60 +1,29 @@
<div class="box wide">
<div class="legend">
Request a Hat
<%= t('.title') %>
</div>
<p>
A hat is a formal, verified, way of posting a comment while speaking for a
project, organization, or company. Each user may have multiple hats, one of
which may be worn at any time when posting a comment or sending a private
message.
</p>
<p>
Hats are intended for core project developers and company employees that are
authorized to make comments on behalf of those organizations, and are usually
reserved for notable projects and organizations. Hats are not intended to
list every contribution a person has made to any software project.
</p>
<p>
Hats will not be authorized for occasional contributors to projects,
developers of projects which are not widely known, past employees of
companies, or other situations where it cannot be verified that one is
authorized to represent that organization. In general, unless one has an
e-mail address at a compay domain or have commit access to a project, a hat
will not be authorized.
</p>
<p>
To request a hat for your account, provide a short description of the hat
(e.g., "OpenBSD Developer"), a public link that will be shown when hovering
over the hat that users can see, such as your e-mail address at that project
or company, or a link to a company website showing your employment, and
private comments that will be seen only by moderators during approval.
</p>
<p>
Once your hat is requested, a moderator will verify your request by e-mailing
the address you submitted as the link, or doing some other manual
verification of project association.
</p>
<%= raw(t('.description')) %>
<%= form_for @hat_request, :url => create_hat_request_path do |f| %>
<p>
<%= f.label :hat, "Hat:" %>
<%= f.label :hat, t('.hat') %>
<%= f.text_field :hat, :size => 20,
:placeholder => "XYZ Project Member" %>
:placeholder => t('.hatplaceholder') %>
<br />
<%= f.label :link, "Link:" %>
<%= f.label :link, t('.link') %>
<%= f.text_field :link, :size => 50,
:placeholder => "user@project.org, or a URL to an employment page" %>
:placeholder => t('.linkplaceholder') %>
<br />
<%= f.label :comment, "Comment:" %>
<%= f.label :comment, t('.comment') %>
<%= f.text_area :comment, :rows => 4,
:placeholder => "Will only be shown to moderators during approval" %>
:placeholder => t('.commentplaceholder') %>
</p>
<p>
<%= submit_tag "Request Hat" %>
<%= submit_tag t('.requesthatbutton') %>
</p>
<% end %>
</div>

View file

@ -1,25 +1,22 @@
<div class="box wide">
<% if @user %>
<div class="legend right">
<a href="<%= request_hat_url %>">Request Hat</a>
<a href="<%= request_hat_url %>"><%= t('.request') %></a>
</div>
<% end %>
<div class="legend">
Hats
<%= t('.title') %>
</div>
<p>
A hat is a formal, verified, way of posting a comment while speaking for a
project, organization, or company. Each user may have multiple hats, one of
which may be selected to be worn when posting a comment or sending a private
message.
<%= t('.description') %>
</p>
<table class="data" width="100%" cellspacing=0>
<tr>
<th style="width: 130px;">User</th>
<th>Hat</th>
<th>Link</th>
<th style="width: 130px;"><%= t('.user') %></th>
<th><%= t('.hat') %></th>
<th><%= t('.link') %></th>
</tr>
<% bit = 0 %>
<% @hat_groups.keys.sort_by{|a| a.downcase }.each do |hg| %>

View file

@ -1,10 +1,10 @@
<div class="box wide">
<div class="legend">
Requested Hats
<%= t('.title') %>
</div>
<% if @hat_requests.count == 0 %>
No hat requests.
<%= t('.nohatrequests') %>
<% else %>
<% @hat_requests.each_with_index do |hr,x| %>
<% if x > 0 %>
@ -15,42 +15,42 @@
:method => :post do |f| %>
<p>
<div class="boxline">
<%= f.label :user_id, "User:", :class => "required" %>
<%= f.label :user_id, t('.user'), :class => "required" %>
<a href="/u/<%= hr.user.username %>"><%= hr.user.username %></a>
</div>
<div class="boxline">
<%= f.label :hat, "Hat:", :class => "required" %>
<%= f.label :hat, t('.hat'), :class => "required" %>
<%= f.text_field "hat", :size => 25 %>
</div>
<div class="boxline">
<%= f.label :link, "Link:", :class => "required" %>
<%= f.label :link, t('.link'), :class => "required" %>
<%= f.text_field "link", :size => 75 %>
</div>
<div class="boxline">
<%= f.label :link, "Comment:", :class => "required" %>
<%= f.label :link, t('.comment'), :class => "required" %>
<div class="d">
<%= raw(h(hr.comment.to_s).gsub(/\n/, "<br>")) %>
</div>
</div>
<p style="clear: both;">
<%= submit_tag "Approve Hat Request" %>
<%= submit_tag t('.approve') %>
</p>
<% end %>
<p>
or
<%= t('.hator') %>
</p>
<%= form_for hr, :url => reject_hat_request_url(:id => hr),
:method => :post do |f| %>
<div class="boxline">
<%= f.label :link, "Reason:", :class => "required" %>
<%= f.label :link, t('.reason'), :class => "required" %>
<%= f.text_area :rejection_comment, :rows => 4 %>
</div>
<p>
<%= submit_tag "Reject Hat Request" %>
<%= submit_tag t('.reject') %>
</p>
<% end %>
<% end %>

View file

@ -123,6 +123,41 @@ en:
pretextdesc: "prefix text with at least<tt>&nbsp;&nbsp;&nbsp;&nbsp;4 spaces</tt>"
inlineimage: "(inline image)"
inlineimagedesc: "![alt text](http://example.com/image.jpg)</tt> (only allowed in story text)"
hats:
build_request:
title: "Request a Hat"
description: "<p>A hat is a formal, verified, way of posting a comment while speaking for a project, organization, or company. Each user may have multiple hats, one of which may be worn at any time when posting a comment or sending a private message.</p><p>Hats are intended for core project developers and company employees that are authorized to make comments on behalf of those organizations, and are usually reserved for notable projects and organizations. Hats are not intended to list every contribution a person has made to any software project.</p><p>Hats will not be authorized for occasional contributors to projects, developers of projects which are not widely known, past employees of companies, or other situations where it cannot be verified that one is authorized to represent that organization. In general, unless one has an e-mail address at a compay domain or have commit access to a project, a hat will not be authorized.</p><p>To request a hat for your account, provide a short description of the hat (e.g., \"OpenBSD Developer\"), a public link that will be shown when hovering over the hat that users can see, such as your e-mail address at that project or company, or a link to a company website showing your employment, and private comments that will be seen only by moderators during approval.</p><p>Once your hat is requested, a moderator will verify your request by e-mailing the address you submitted as the link, or doing some other manual verification of project association.</p>"
hat: "Hat:"
hatplaceholder: "XYZ Project Member"
link: "Link:"
linkplaceholder: "user@project.org, or a URL to an employment page"
comment: "Comment:"
commentplaceholder: "Will only be shown to moderators during approval"
requesthatbutton: "Request Hat"
create_request:
submittedhatrequest: "Successfully submitted hat request."
index:
title: "Hats"
description: "A hat is a formal, verified, way of posting a comment while speaking for a project, organization, or company. Each user may have multiple hats, one of which may be selected to be worn when posting a comment or sending a private message."
request: "Request Hat"
user: "User"
hat: "Hat"
link: "Link"
reject_request:
requestedhatrequest: "Successfully rejected hat request."
requests_index:
title: "Requested Hats"
nohatrequests: "No hat requests."
user: "User:"
hat: "Hat:"
link: "Link:"
comment: "Comment:"
approve: Approve Hat Request"
reason: "Reason:"
reject: "Reject Hat Request"
hator: "or"
approve_request:
approvedhatrequest: "Successfully approved hat request."
home:
index:
homerecentsdesc: "<em>The <a href=\"/newest\">newest</a> stories with a random sampling of recently submitted stories that have not yet reached the front page.</em>"

View file

@ -123,6 +123,41 @@ fr:
pretextdesc: "précéder le texte avec au moins <tt>&nbsp;&nbsp;&nbsp;&nbsp;4 espaces</tt>"
inlineimage: "(image en ligne)"
inlineimagedesc: "![texte de substitution](http://example.com/image.jpg)</tt> (autorisé seulement dans les articles)"
hats:
build_request:
title: "Demander un chapeau"
description: "<p>Un chapeau est un moyen formel, vérifié de poster un commentaire au nom d'un projet, d'une organisation ou d'une entreprise. Chaque utilisateur peut avoir plusieurs chapeaux, l'un d'eux pouvant être choisi d'être porté au moment de poster un commentaire ou d'envoyer un message privé.</p><p>Les chapeaux sont destinés aux développeurs principaux d'un projet et les employés d'entreprise qui sont autorisés à faire des commentaires au nom de leurs organisations, et sont habituellement réservés pour les projets notables et les organisations. Les chapeaux ne sont pas destinés à lister toutes les contributions d'une personne à des projets logiciels.</p><p>Les chapeaux ne vont pas être autorisés pour les contributeurs occasionnels d'un projet, développeurs d'un projet qui n'est pas largement connu, pas non plus pour les anciens employés d'une entreprise ou autres situations où il n'est pas possible de vérifier que quelqu'un est autorisé à représenter une organisation. En général à moins d'avoir un e-mail avec le nom de domaine de l'entreprise ou du projet ou les droits d'accès aux sources d'un projet, un chapeau ne sera pas autorisé.</p><p>Pour demander un chapeau pour votre compte, merci de fournir une courte description du chapeau (exemple \"développeur OpenBSD\"), un lien public qui sera affiché quand on passe la souris au-dessus du chapeau que les utilisateurs peuvent voir, comme votre adresse e-mail du projet ou de l'entreprise ou un lien vers le site web de l'entreprise puis une description privée qui sera seulement vue par les modérateurs durant le processus d'approbation.</p><p>Une fois qu'un chapeau a été demandé, un modérateur va vérifier votre demande en envoyant un e-mail à l'adresse soumise comme lien et/ou en effectuant d'autres vérifications manuelles de votre association au projet.</p>"
hat: "Chapeau:"
hatplaceholder: "Membre du projet XYZ"
link: "Lien :"
linkplaceholder: "membre@projet.org, ou l'URL de la page de l'employeur"
comment: "Commentaire :"
commentplaceholder: "Sera seulement montré aux modérateurs devant le processus d'approbation"
requesthatbutton: "Demander un chapeau"
create_request:
submittedhatrequest: "Demande de chapeau transmise avec succès."
index:
title: "Chapeaux"
description: "Un chapeau est un moyen formel, vérifié de poster un commentaire au nom d'un projet, d'une organisation ou d'une entreprise. Chaque utilisateur peut avoir plusieurs chapeaux, l'un d'eux pouvant être choisi d'être porté au moment de poster un commentaire ou d'envoyer un message privé."
request: "Demander un chapeau"
user: "Utilisateur"
hat: "Chapeau"
link: "Lien"
reject_request:
rejectedhatrequest: "Demande de chapeau rejetée avec succès."
requests_index:
title: "Chapeaux demandés"
nohatrequests: "Aucune demande de chapeau."
user: "Utilisateur :"
hat: "Chapeau :"
link: "Lien :"
comment: "Commentaire :"
approve: "Approuver la demande de chapeau"
reason: "Raison :"
reject: "Rejeter la demande de chapeau"
hator: "ou"
approve_request:
approvedhatrequest: "La demande de chapeau a été approuvée."
home:
index:
homerecentsdesc: "<em>Les <a href=\"/newest\">plus récentes</a> infos avec un panaché aléatoire des infos récentes soumises qui n'ont pas encore atteint la page principale.</em>"