Skip to content

Commit

Permalink
translated all js validations
Browse files Browse the repository at this point in the history
  • Loading branch information
ympadilha committed Apr 29, 2014
1 parent 9f2fc79 commit eed1356
Show file tree
Hide file tree
Showing 12 changed files with 120 additions and 31 deletions.
36 changes: 33 additions & 3 deletions src/main/resources/messages.properties
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,15 @@ metas.privacy_policy.title = Privacy policy
metas.edit_profile.title = Edit profile
metas.profile.title = Profile

metas.questions_lowercase = questions
metas.answers_lowercase = answers
metas.comments_lowercase = comments
metas.watched_lowercase = watched
metas.assist_me = socorro
metas.help = ajuda
metas.help_me = ajudar
metas.urgent = urgent

#GENERIC BUTTONS
cancel_button = Cancel

Expand Down Expand Up @@ -93,7 +102,7 @@ about.faq.bad_question.answer = It was probably not relevant. Any questions with
about.faq.where_is_my_karma = I suddenly received or lost a lot of points, what happened?
about.faq.where_is_my_karma.answer = You received votes in a suspect way or exceeded the limit of reputation acquired in a given period. Avoid manipulating the voting system to gain reputation in a easy way; remember that the system's purpose is to help people and the reputation is only a consequence.

#SEARCH
# SEARCH
search.placeholder = search

# LOGIN
Expand Down Expand Up @@ -575,7 +584,10 @@ notification_mail.footer_message = <p>\
</p>\
<p>{0} team</p>

# ERRORS

error.not_allowed = You don't have permission for this
error.cant_do = You can't do that
error.occured = An error has occured
error.author.cant_realize_operation = The author can't execute this operation!

Expand All @@ -594,6 +606,11 @@ newsletter.link.text.caelum = Caelum courses
newsletter.link.text.alura = Online tecnology courses in Alura
newsletter.link.text.cdc = Casa do Código books.

# HINTS

hint.choose_an_option = Choose an option.
hint.describe_reason = Describe the reason.
hint.choose_a_reason = Choose a reason

# BUTTON HINTS
button_hint.links.text = Link
Expand Down Expand Up @@ -706,12 +723,25 @@ validator.invalid.url = The provided URL is invalid
validator.minimum.characters = Please, provide at least {0} characters.
validator.maximum.characters = Please, provide at most {0} characters.

validation.avoid_only_uppercase_title = Do not use only uppercase letters in the title
validation.avoid_only_uppercase_post = Do not use only uppercase letters in the description of your post
validation.avoid_use_of = Avoid using words like 'Helpme', 'Urgent', 'Please' in your question's title
validation.do_not_use = Do not use the word 'solved' in the title, mark the answer that solved you problem as solution
validation.make_clear_post = Leave complete and clear posts, avoid informalities (like 'ya', 'lol') or punctuation excess (like !!, ?? e ...)
validation.suggestion_sent = Suggestion sent!
validation.use_only_existing_tags = Use only existing tags, the following tag do not exist:
validation.follow_post = Click here to be notified about this questions news.
validation.cancel_follow_post = Click here to stop following this post.

show_all = Show all
the_comments = comments

#User Interaction
# User Interaction
user.interactions = You participate in this question!
user.moderation.details = See details
user.moderation.details.type = Type
user.moderation.details.author = Author
user.moderation.details.date = Last Update
user.moderation.details.noDetails = There are no votes nor flags
user.moderation.details.noDetails = There are no votes nor flags
user.block_user = Block user
user.unblock_user = Unblock user
36 changes: 34 additions & 2 deletions src/main/resources/messages_pt_BR.properties
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,16 @@ metas.privacy_policy.title = Pol
metas.edit_profile.title = Editar perfil
metas.profile.title = Profile

metas.questions_lowercase = perguntas
metas.answers_lowercase = respostas
metas.comments_lowercase = comentários
metas.watched_lowercase = acompanhadas
metas.assist_me = assist-me
metas.help = help
metas.help_me = help-me
metas.urgent = urgente


#GENERIC BUTTONS
cancel_button = Cancelar

Expand Down Expand Up @@ -576,7 +586,10 @@ notification_mail.footer_message = <p>\
</p>\
<p>Equipe {0}</p>

# ERRORS

error.not_allowed = Você não tem permissão para isso
error.cant_do = Você não pode fazer isso
error.occured = Ocorreu um erro
error.author.cant_realize_operation = O autor não pode realizar esta operação!

Expand All @@ -595,6 +608,11 @@ newsletter.link.text.caelum = Cursos da Caelum
newsletter.link.text.alura = Cursos online de tecnologia do Alura
newsletter.link.text.cdc = Livros da Casa do Código

# HINTS

hint.choose_an_option = Escolha uma opção.
hint.describe_reason = Descreva o motivo.
hint.choose_a_reason = Escolha um motivo

# BUTTON HINTS
button_hint.links.text = Link
Expand Down Expand Up @@ -706,11 +724,25 @@ validator.invalid.url = A Url inserida n
validator.minimum.characters = Por favor, insira ao menos {0} caracteres.
validator.maximum.characters = Por favor, insira no máximo {0} caracteres.

validation.avoid_only_uppercase_title = Não utilize apenas letras maiúsculas no título
validation.avoid_only_uppercase_post = Não utilize apenas letras maiúsculas na descrição da sua postagem
validation.avoid_use_of = Evite usar termos como 'Socorro', 'Urgente', 'Please' no título da sua pergunta
validation.do_not_use = Não coloque a palavra 'resolvido' no título, marque a resposta que resolveu sua pergunta como certa
validation.make_clear_post = Deixe sua postagem clara e completa, evite informalidades (como 'vc', 'kkk') ou excesso de pontuação (como !!, ?? e ...)
validation.suggestion_sent = Sugestão enviada!
validation.use_only_existing_tags = Use apenas tags que existem! As seguintes tags não existem:
validation.follow_post = Clique aqui para ser notificado de novidades nessa questão e suas respostas.
validation.cancel_follow_post = Clique aqui para cancelar a notificação de novidades nessa questão e suas respostas.

show_all = Mostrar todos
the_comments = os comentários

#User Interaction
# User Interaction
user.interactions = Você participa dessa questão!
user.moderation.details = Ver detalhes
user.moderation.details.type = Tipo
user.moderation.details.author = Autor
user.moderation.details.date = Última atualização
user.moderation.details.noDetails = Não há votos nem marcações
user.moderation.details.noDetails = Não há votos nem marcações
user.block_user = Bloquear usuário
user.unblock_user = Desbloquar usuário
27 changes: 27 additions & 0 deletions src/main/webapp/WEB-INF/jsp/coda.jspf
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,33 @@
MESSAGES['author_cant_realize_operation'] = "<fmt:message key='error.author.cant_realize_operation' />";
MESSAGES['auth_requires_login'] = "<fmt:message key='auth.requires_login' />";
MESSAGES['click.to_close'] = "<fmt:message key='button_hint.click_to_close' />";
MESSAGES['block_user'] = "<fmt:message key='user.block_user' />";
MESSAGES['unblock_user'] = "<fmt:message key='user.unblock_user' />";
MESSAGES['cant_do'] = "<fmt:message key='error.cant_do' />";
MESSAGES['choose_an_option'] = "<fmt:message key='hint.choose_an_option' />";
MESSAGES['describe_reason'] = "<fmt:message key='hint.describe_reason' />";
MESSAGES['choose_a_reason'] = "<fmt:message key='hint.choose_a_reason' />";
MESSAGES['answers'] = "<fmt:message key='metas.answers_lowercase' />";
MESSAGES['questions'] = "<fmt:message key='metas.questions_lowercase' />";
MESSAGES['comments'] = "<fmt:message key='metas.comments_lowercase' />";
MESSAGES['watched'] = "<fmt:message key='metas.watched_lowercase' />";
MESSAGES['help'] = "<fmt:message key='metas.help' />";
MESSAGES['help_me'] = "<fmt:message key='metas.help_me' />";
MESSAGES['urgent'] = "<fmt:message key='metas.urgent' />";
MESSAGES['assist_me'] = "<fmt:message key='metas.assist_me' />";
MESSAGES['avoid_only_uppercase_title'] = "<fmt:message key='validation.avoid_only_uppercase_title' />";
MESSAGES['avoid_only_uppercase_post'] = "<fmt:message key='validation.avoid_only_uppercase_title' />";
MESSAGES['avoid_use_of'] = "<fmt:message key='validation.avoid_use_of' />";
MESSAGES['do_not_use'] = "<fmt:message key='validation.do_not_use' />";
MESSAGES['make_clear_post'] = "<fmt:message key='validation.make_clear_post' />";
MESSAGES['suggestion_sent'] = "<fmt:message key='validation.suggestion_sent' />";
MESSAGES['use_only_existing_tags'] = "<fmt:message key='validation.use_only_existing_tags' />";
MESSAGES['follow_post'] = "<fmt:message key='validation.follow_post' />";
MESSAGES['unfollow_post'] = "<fmt:message key='validation.cancel_follow_post' />";
MESSAGES['show_all'] = "<fmt:message key='show_all' />";
MESSAGES['the_comments'] = "<fmt:message key='the_comments' />";


</script>

<c:if test="${environment.name != 'production'}" >
Expand Down
4 changes: 2 additions & 2 deletions src/main/webapp/js/ban-user.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ $(function(){
changeText(post.html());
},
error: function(jqXHR) {
errorPopup("Ocorreu um erro...", post, "center-popup");
errorPopup(MESSAGES['error_occured'], post, "center-popup");
console.log(jqXHR);
}
});

function changeText(text){
text == 'Bloquear usuário' ? post.html('Desbloquear usuário') : post.html('Bloquear usuário');
text == MESSAGES['block_user'] ? post.html(MESSAGES['unblock_user']) : post.html(MESSAGES['block_user']);
}
}

Expand Down
12 changes: 6 additions & 6 deletions src/main/webapp/js/flag-it.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ $(".flag-it").click(function(e) {

var callbacks = {};
callbacks["409"] = function() {
errorPopup("Você não pode fazer isso.", modal.element, "center-popup");
errorPopup(MESSAGES['cant_do'], modal.element, "center-popup");
};
callbacks["400"] = function() {
errorPopup("Escolha uma opção.", modal.element, "center-popup");
errorPopup(MESSAGES['choose_an_option'], modal.element, "center-popup");
};
callbacks["403"] = function() {
errorPopup("Você deve estar logado.", modal.element, "center-popup");
errorPopup(MESSAGES['auth_requires_login'], modal.element, "center-popup");
};
callbacks["200"] = function() {
modal.hide(200);
Expand All @@ -35,20 +35,20 @@ $(".flag-it").click(function(e) {
e.preventDefault();
var checked = form.find("input:radio:checked");
if (isEmpty(checked)) {
errors.text("Escolha um motivo").show();
errors.text(MESSAGES['choose_a_reason']).show();
return;
}
reason = form.find("textarea");
if (checked.val() == "OTHER" && isEmpty(reason.val())) {
errors.text("Descreva o motivo").show();
errors.text(MESSAGES['describe_reason']).show();
return;
}
$.ajax(uri, {
complete : function(xhr, textStatus) {
if (callbacks[xhr.status] != undefined) {
callbacks[xhr.status].call();
} else {
errorPopup("Ocorreu um erro.", modal, "center-popup");
errorPopup(MESSAGES['error_occured'], modal, "center-popup");
console.log(xhr);
}
},
Expand Down
2 changes: 1 addition & 1 deletion src/main/webapp/js/mark-as-solution.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ $(function(){
},
error: function(jqXHR) {
toggleAll();
errorPopup("Ocorreu um erro...", mark, "center-popup");
errorPopup(MESSAGES['error_occured'], mark, "center-popup");
console.log(jqXHR);
}
});
Expand Down
2 changes: 1 addition & 1 deletion src/main/webapp/js/more-comments.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ $('.more-comments').click(function(){
collapsed.toggleClass("hidden");

if(!collapsed.hasClass("hidden")) $(this).html("Ocultar comentários");
else $(this).html("Mostrar todos os <strong>" + $(this).attr("size") + "</strong> comentários");
else $(this).html(MESSAGES['show_all'] + " <strong>" + $(this).attr("size") + "</strong> " + MESSAGES['the_comments']);
});
6 changes: 3 additions & 3 deletions src/main/webapp/js/order-by.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
$(function(){
var ANSWER = "respostas",
QUESTION = "perguntas"
WATCHED = "acompanhadas";
var ANSWER = MESSAGES['answers'],
QUESTION = MESSAGES['perguntas']
WATCHED = MESSAGES['watched'].

$(".advanced-data-section").on("click", ".order-by" , function(event){
event.preventDefault();
Expand Down
12 changes: 6 additions & 6 deletions src/main/webapp/js/question-warnings.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,16 +39,16 @@ $(function() {
var title = input.val();
var messageClass = "title-messages";
messages.find("li."+messageClass).remove();
var illegalWords = ["ajuda", "ajudar", "help", "socorro", "urgente", "please"];
var illegalWords = [MESSAGES['help'], MESSAGES['help_me'], "help", MESSAGES['assist_me'], MESSAGES['urgent'], "please"];

validateRule(title.toUpperCase() == title && title.length > 1,
"Não utilize apenas letras maiúsculas no título",
MESSAGES['avoid_only_uppercase_title'],
messageClass);
validateRule(containsIllegalWords(title, illegalWords),
"Evite usar termos como 'Socorro', 'Urgente', 'Please' no título da sua pergunta",
MESSAGES['avoid_use_of'],
messageClass);
validateRule(containsIllegalWords(title, ["resolvido"]),
"Não coloque a palavra 'resolvido' no título, marque a resposta que resolveu sua pergunta como certa",
MESSAGES['do_not_use'],
messageClass);

cleanMessages();
Expand All @@ -61,10 +61,10 @@ $(function() {
messages.find("li."+messageClass).remove();
var illegalWords = ["kkk", "vc", "!!", "??", "..."];
validateRule(description.toUpperCase() == description && description.length > 1,
"Não utilize apenas letras maiúsculas na descrição da postagem",
MESSAGES['avoid_only_uppercase_post'],
messageClass);
validateRule(containsIllegalWords(description, illegalWords),
"Deixe sua postagem clara e completa, evite informalidades (como 'vc', 'kkk') ou excesso de pontuação (como !!, ?? e ...)",
MESSAGES['make_clear_post'],
messageClass);
cleanMessages();
});
Expand Down
6 changes: 3 additions & 3 deletions src/main/webapp/js/simple-ajax-form.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,17 +50,17 @@ $(function() {
var error = function(jqXHR) {
resetForm(form, false);
if (jqXHR.status == 400) {
errorPopup("Ocorreu um erro de validação inesperado.", form.parent(), "center-popup");
errorPopup(MESSAGES['error_occured'], form.parent(), "center-popup");
return;
}
errorPopup("Ocorreu um erro.", form.parent(), "center-popup");
errorPopup(MESSAGES['error_occured'], form.parent(), "center-popup");
console.log(jqXHR);
};

var success = function(response, status, jqhr) {
var target = $("#" + form.data("ajax-result"));
if (jqhr.status == 201) {
target.append("<span class='suggestion-accepted'>Sugest&atilde;o enviada!</span>");
target.append("<span class='suggestion-accepted'>" + MESSAGES['suggestion_sent'] + "</span>");
} else {
var action = form.data("ajax-on-callback") || "replace-inner";
if (action == "replace-inner") {
Expand Down
2 changes: 1 addition & 1 deletion src/main/webapp/js/tags-manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@
return valid;
},
function(){
return "Use apenas tags que existem! As seguintes tags não existem: <b>"+ tagsNotFound + "</b>";
return MESSAGES['use_only_existing_tags'] + "<b>" + tagsNotFound + "</b>";
}
);

Expand Down
6 changes: 3 additions & 3 deletions src/main/webapp/js/watch.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ $(function(){
toggleClassOf(icon);
},
error: function(jqXHR) {
errorPopup("Ocorreu um erro...", post, "center-popup");
errorPopup(MESSAGES['error_occured'], post, "center-popup");
console.log(jqXHR);
}
});
Expand All @@ -24,9 +24,9 @@ $(function(){
icon.toggleClass("icon-eye");

if(icon.hasClass("icon-muted")) {
icon.attr("title", "Clique aqui para ser notificado de novidades nessa questão e suas respostas.");
icon.attr("title", MESSAGES['follow_post']);
} else {
icon.attr("title", "Clique aqui para cancelar a notificação de novidades nessa questão e suas respostas.");
icon.attr("title", MESSAGES['unfollow_post']);
}
}
}
Expand Down

0 comments on commit eed1356

Please sign in to comment.