Merge pull request #6901 from svbergerem/remove-unused-translations

Remove unused translations
This commit is contained in:
Jonne Haß 2016-07-03 20:59:06 +02:00 committed by GitHub
commit 9aaf58de12
33 changed files with 98 additions and 394 deletions

View file

@ -285,7 +285,7 @@ app.views.Publisher = Backbone.View.extend({
var pollAnswersArray = _.flatten([serializedForm["poll_answers[]"]]);
var pollAnswers = _.map(pollAnswersArray, function(answer){
if (answer) {
return { "answer" : answer };
return {"answer": answer, "vote_count": 0};
}
});
pollAnswers = _.without(pollAnswers, undefined);

View file

@ -20,12 +20,11 @@ Diaspora.I18n = {
updateLocale: function(locale, data) {
locale.data = $.extend(locale.data, data);
var rule = this._resolve(locale, ['pluralization_rule']);
if (rule !== "") {
/* jshint evil:true */
// TODO change this to `locale.pluralizationKey = rule`?
var rule = locale.data.pluralization_rule;
if (typeof rule !== "undefined") {
/* eslint-disable no-eval */
eval("locale.pluralizationKey = "+rule);
/* jshint evil:false */
/* eslint-enable no-eval */
}
},
@ -46,14 +45,9 @@ Diaspora.I18n = {
: locale.data[nextNamespace];
if(typeof translatedMessage === "undefined") {
if (typeof locale.fallback === "undefined") {
return "";
} else {
return this._resolve(locale.fallback, originalItems);
}
throw new Error("Missing translation: " + originalItems.join("."));
}
}
return translatedMessage;
},
@ -68,7 +62,7 @@ Diaspora.I18n = {
return _.template(this._resolve(locale, items))(views || {});
} catch (e) {
if (typeof locale.fallback === "undefined") {
return "";
throw e;
} else {
return this._render(locale.fallback, originalItems, views);
}
@ -86,4 +80,3 @@ Diaspora.I18n = {
}
};
// @license-end

View file

@ -1,6 +1,6 @@
<div class='pull-right'>
{{#if loggedIn}}
<a href="#" class="like" title="{{#if userLike}} {{t "viewer.unlike"}} {{else}} {{t "viewer.like"}} {{/if}}">
<a href="#" class="like" title="{{#if userLike}} {{t "stream.unlike"}} {{else}} {{t "stream.like"}} {{/if}}">
{{#if userLike}}
<i class="entypo-heart red large"></i>
{{else}}
@ -8,12 +8,12 @@
{{/if}}
</a>
<a href="#" class="focus-comment" title="{{t "viewer.comment"}}">
<a href="#" class="focus-comment" title="{{t "stream.comment"}}">
<i class="entypo-comment gray large"></i>
</a>
{{#if userCanReshare}}
<a href="#" class="reshare" title="{{t "viewer.reshare"}}">
<a href="#" class="reshare" title="{{t "stream.reshare"}}">
<i class="entypo-reshare gray large"></i>
</a>
{{else}}

View file

@ -1,4 +1,6 @@
module LanguageHelper
include ApplicationHelper
def available_language_options
options = []
AVAILABLE_LANGUAGES.each do |locale, language|

View file

@ -46,7 +46,7 @@
= text_field_tag "identifier", nil, class: "form-control"
.form-group
.clearfix.col-md-12
= submit_tag t("services.remote_friend.invite"), class: "btn btn-default pull-right"
= submit_tag t(".invite"), class: "btn btn-default pull-right"
.row
.col-md-12

View file

@ -1,7 +1,7 @@
%div
%select.aspect_dropdown.form-control.user_aspects{"name" => "user_aspects", "data-person-id" => @person.id}
%option{value: 'list_cover', class: 'list_cover', disabled: 'true', selected: 'true'}
= t("add_contact")
= t("contacts.index.add_contact")
- contact = current_user.contact_for(@person)
- current_user.aspects.each do |aspect|
- if contact.try(:in_aspect?, aspect)

View file

@ -13,9 +13,9 @@
-if AppConfig.chat.enabled?
= link_to aspect_toggle_chat_privilege_path(@aspect), id: "chat_privilege_toggle", class: "contacts_button", method: :put, remote: true do
-if @aspect.chat_enabled?
%i.entypo-chat.enabled.contacts-header-icon{title: t("aspects.edit.aspect_chat_is_enabled")}
%i.entypo-chat.enabled.contacts-header-icon{title: t("javascripts.contacts.aspect_chat_is_enabled")}
-else
%i.entypo-chat.contacts-header-icon{title: t("aspects.edit.aspect_chat_is_not_enabled")}
%i.entypo-chat.contacts-header-icon{title: t("javascripts.contacts.aspect_chat_is_not_enabled")}
= link_to @aspect, method: "delete", data: { confirm: t("aspects.edit.confirm_remove_aspect") }, class: "delete contacts_button", id: "delete_aspect" do
%i.entypo-trash.contacts-header-icon{title: t("delete")}

View file

@ -107,6 +107,8 @@ module Diaspora
}
config.action_mailer.asset_host = AppConfig.pod_uri.to_s
config.action_view.raise_on_missing_translations = true
config.middleware.use Rack::OAuth2::Server::Resource::Bearer, "OpenID Connect" do |req|
Api::OpenidConnect::OAuthAccessToken
.valid(Time.zone.now.utc).find_by(token: req.access_token) || req.invalid_token!

View file

@ -21,9 +21,6 @@ en:
delete: "Delete"
hide: "Hide"
ignore: "Ignore"
undo: "Undo?"
or: "or"
ago: "%{time} ago"
username: "Username"
email: "Email"
password: "Password"
@ -39,8 +36,6 @@ en:
find_people: "Find people or #tags"
_home: "Home"
more: "More"
next: "Next"
previous: "Previous"
_comments: "Comments"
all_aspects: "All aspects"
no_results: "No results found"
@ -123,6 +118,7 @@ en:
account_locking_scheduled: "The account of %{name} is scheduled to be locked. It will be processed in a few moments..."
account_unlocking_scheduled: "The account of %{name} is scheduled to be unlocked. It will be processed in a few moments..."
email_to: "Email to invite"
invite: "Invite"
under_13: "Show users that are under 13 (COPPA)"
users:
zero: "%{count} users found"
@ -174,11 +170,6 @@ en:
tag_name: "Tag name: <b>%{name_tag}</b> Count: <b>%{count_tag}</b>"
pods:
pod_network: "Pod network"
application:
helper:
unknown_person: "Unknown person"
video_title:
unknown: "Unknown video title"
aspects:
contacts_visible: "Contacts in this aspect will be able to see each other."
contacts_not_visible: "Contacts in this aspect will not be able to see each other."
@ -191,12 +182,8 @@ en:
rename: "Rename"
aspect_list_is_visible: "Contacts in this aspect are able to see each other."
aspect_list_is_not_visible: "Contacts in this aspect are not able to see each other."
aspect_chat_is_enabled: "Contacts in this aspect are able to chat with you."
aspect_chat_is_not_enabled: "Contacts in this aspect are not able to chat with you."
update: "Update"
updating: "Updating"
no_posts_message:
start_talking: "Nobody has said anything yet!"
no_contacts_message:
you_should_add_some_more_contacts: "You should add some more contacts!"
try_adding_some_more_contacts: "You can search or %{invite_link} more contacts."
@ -233,13 +220,6 @@ en:
donate: "Donate"
keep_pod_running: "Keep %{pod} running fast and buy servers their coffee fix with a monthly donation!"
keep_diaspora_running: "Keep diaspora* development fast with a monthly donation!"
no_tags: "+ Find a tag to follow"
unfollow_tag: "Stop following #%{tag}"
handle_explanation: "This is your diaspora* ID. Like an email address, you can give this to people to reach you."
no_contacts: "No contacts"
post_a_message: "Post a message >>"
people_sharing_with_you: "People sharing with you"
welcome_to_diaspora: "Welcome to diaspora*, %{name}!"
introduce_yourself: "This is your stream. Jump in and introduce yourself."
@ -265,10 +245,6 @@ en:
any_problem: "Got a problem?"
contact_podmin: "Contact the administrator of your pod!"
mail_podmin: "Podmin email"
diaspora_id:
heading: "diaspora* ID"
content_1: "Your diaspora* ID is:"
content_2: "Give it to anyone and theyll be able to find you on diaspora*."
services:
heading: "Connect services"
content: "You can connect the following services to diaspora*:"
@ -311,11 +287,9 @@ en:
sharing:
people_sharing: "People sharing with you:"
index:
add_to_aspect: "Add contacts to %{name}"
start_a_conversation: "Start a conversation"
add_a_new_aspect: "Add a new aspect"
title: "Contacts"
your_contacts: "Your contacts"
no_contacts: "Looks like you need to add some contacts!"
no_contacts_message: "Check out %{community_spotlight}"
community_spotlight: "Community spotlight"
@ -334,12 +308,9 @@ en:
index:
conversations_inbox: "Conversations Inbox"
new_conversation: "New conversation"
no_conversation_selected: "No conversation selected"
create_a_new_conversation: "Start a new conversation"
no_messages: "No messages"
inbox: "Inbox"
conversation:
participants: "Participants"
show:
reply: "Reply"
replying: "Replying..."
@ -353,12 +324,6 @@ en:
message: "Message"
send: "Send"
sending: "Sending..."
abandon_changes: "Abandon changes?"
helper:
new_messages:
zero: "No new messages"
one: "1 new messages"
other: "%{count} new messages"
create:
sent: "Message sent"
fail: "Invalid message"
@ -624,25 +589,19 @@ en:
report_bugs: "report them"
invitation_codes:
excited: "%{name} is excited to see you here."
not_valid: "That invite code is no longer valid"
invitations:
create:
sent: "Invitations have been sent to: %{emails}"
rejected: "The following email addresses had problems: "
no_more: "You have no more invitations."
already_sent: "You already invited this person."
already_contacts: "You are already connected with this person"
own_address: "You cant send an invitation to your own address."
empty: "Please enter at least one email address."
note_already_sent: "Invitations have already been sent to: %{emails}"
new:
language: "Language"
invite_someone_to_join: "Invite someone to join diaspora*!"
if_they_accept_info: "if they accept, they will be added to the aspect you invited them."
comma_separated_plz: "You can enter multiple email addresses separated by commas."
check_out_diaspora: "Hey! You should check out diaspora*"
to: "To"
personal_message: "Personal message"
send_an_invitation: "Send an invitation"
@ -653,15 +612,8 @@ en:
zero: "No invites left on this code"
one: "One invite left on this code"
other: "%{count} invites left on this code"
aspect: "Aspect"
already_invited: "The following people have not accepted your invitation:"
resend: "Resend"
check_out_diaspora: "Check out diaspora*!"
check_token:
not_found: "Invitation token not found"
edit:
your_account_awaits: "Your account awaits!"
accept_your_invitation: "Accept your invitation"
a_facebook_user: "A Facebook user"
layouts:
@ -670,7 +622,6 @@ en:
settings: "Settings"
help: "Help"
logout: "Log out"
blog: "Blog"
login: "Log in"
code: "Code"
admin: "Admin"
@ -693,14 +644,6 @@ en:
zero: "No likes"
one: "%{count} like"
other: "%{count} likes"
people_like_this_comment:
zero: "No likes"
one: "%{count} like"
other: "%{count} likes"
people_dislike_this:
zero: "No dislikes"
one: "%{count} dislike"
other: "%{count} dislikes"
notifications:
started_sharing:
@ -722,7 +665,7 @@ en:
mentioned:
zero: "%{actors} have mentioned you in the post %{post_link}."
one: "%{actors} has mentioned you in the post %{post_link}."
other: "%{actors} have mentioned you in the %{post_link}."
other: "%{actors} have mentioned you in the post %{post_link}."
liked:
zero: "%{actors} have liked your post %{post_link}."
one: "%{actors} has liked your post %{post_link}."
@ -942,9 +885,24 @@ en:
openid:
name: "basic profile"
description: "This allows the application to read your basic profile"
extended:
sub:
name: "sub"
description: "This grants sub permissions to the application"
aud:
name: "aud"
description: "This grants aud permissions to the application"
name:
name: "name"
description: "This grants name permissions to the application"
nickname:
name: "nickname"
description: "This grants nickname permissions to the application"
profile:
name: "extended profile"
description: "This allows the application to read your extended profile"
picture:
name: "picture"
description: "This grants picture permissions to the application"
read:
name: "read profile, stream and conversations"
description: "This allows the application to read your stream, your conversations and your complete profile"
@ -962,10 +920,7 @@ en:
one: "1 person"
other: "%{count} people"
person:
pending_request: "Pending request"
already_connected: "Already connected"
thats_you: "Thats you!"
add_contact: "Add contact"
index:
results_for: "Users matching %{search_term}"
no_results: "Hey! You need to search for something."
@ -979,54 +934,23 @@ en:
fail: "Sorry, we couldnt find %{handle}."
show:
has_not_shared_with_you_yet: "%{name} has not shared any posts with you yet!"
incoming_request: "%{name} wants to share with you"
return_to_aspects: "Return to your aspects page"
to_accept_or_ignore: "to accept or ignore it."
does_not_exist: "Person does not exist!"
not_connected: "You are not sharing with this person"
recent_posts: "Recent posts"
recent_public_posts: "Recent public posts"
see_all: "See all"
start_sharing: "Start sharing"
message: "Message"
mention: "Mention"
closed_account: "This account has been closed."
sub_header:
you_have_no_tags: "You have no tags!"
add_some: "Add some"
edit: "Edit"
profile_sidebar:
remove_contact: "Remove contact"
edit_my_profile: "Edit my profile"
bio: "Bio"
location: "Location"
gender: "Gender"
born: "Birthday"
photos: "Photos"
in_aspects: "In aspects"
remove_from: "Remove %{name} from %{aspect}?"
helper:
results_for: " results for %{params}"
is_sharing: "%{name} is sharing with you"
is_not_sharing: "%{name} is not sharing with you"
aspect_list:
edit_membership: "Edit aspect membership"
add_contact_small:
add_contact_from_tag: "Add contact from tag"
add_contact:
invited_by: "You were invited by"
photos:
show:
delete_photo: "Delete photo"
make_profile_photo: "Make profile photo"
update_photo: "Update photo"
edit: "Edit"
edit_delete_photo: "Edit photo description / delete photo"
collection_permalink: "Collection permalink"
show_original_post: "Show original post"
edit:
editing: "Editing"
photo:
view_all: "View all of %{name}s photos"
new:
@ -1037,9 +961,6 @@ en:
runtime_error: "Photo upload failed. Are you sure that your seatbelt is fastened?"
integrity_error: "Photo upload failed. Are you sure that was an image?"
type_error: "Photo upload failed. Are you sure an image was added?"
update:
notice: "Photo successfully updated."
error: "Failed to edit photo."
destroy:
notice: "Photo deleted."
new_photo:
@ -1048,8 +969,6 @@ en:
empty: "{file} is empty, please select files again without it."
new_profile_photo:
upload: "Upload a new profile photo!"
or_select_one_existing: "or select one from your already existing %{photos}"
comment_email_subject: "%{name}s photo"
polls:
votes:
@ -1089,11 +1008,6 @@ en:
created: "A report was created"
failed: "Something went wrong"
share_visibilites:
update:
post_hidden_and_muted: "%{name}s post has been hidden, and notifications have been muted."
see_it_on_their_profile: "If you want to see updates on this post, visit %{name}s profile page."
profiles:
edit:
basic: "My basic profile"
@ -1128,11 +1042,6 @@ en:
registrations:
new:
create_my_account: "Create my account!"
join_the_movement: "Join the movement!"
sign_up_message: "Social networking with a ♥"
enter_email: "Enter your email address"
enter_username: "Pick a username (only letters, numbers, and underscores)"
enter_password: "Enter a password (six character minimum)"
@ -1147,43 +1056,16 @@ en:
terms_link: "terms of service"
create:
success: "Youve joined diaspora*!"
edit:
edit: "Edit %{name}"
leave_blank: "(leave blank if you dont want to change it)"
password_to_confirm: "(we need your current password to confirm your changes)"
unhappy: "Unhappy?"
update: "Update"
cancel_my_account: "Cancel my account"
closed: "Signups are closed on this diaspora* pod."
invalid_invite: "The invite link you provided is no longer valid!"
requests:
manage_aspect_contacts:
manage_within: "Manage contacts within"
existing: "Existing contacts"
destroy:
success: "You are now sharing."
error: "Please select an aspect!"
ignore: "Ignored contact request."
create:
sending: "Sending"
sent: "Youve asked to share with %{name}. They should see it next time they log in to diaspora*."
new_request_to_person:
sent: "Sent!"
helper:
new_requests:
zero: "No new requests"
one: "New request!"
other: "%{count} new requests!"
reshares:
reshare:
reshared_via: "Reshared via"
reshare_original: "Reshare original"
reshare:
zero: "Reshare"
one: "1 reshare"
other: "%{count} reshares"
show_original: "Show original"
reshare_confirmation: "Reshare %{author}s post?"
deleted: "Original post deleted by author."
create:
@ -1215,25 +1097,14 @@ en:
success: "Successfully deleted authentication."
failure:
error: "There was an error connecting to that service"
inviter:
join_me_on_diaspora: "Join me on diaspora*"
click_link_to_accept_invitation: "Follow this link to accept your invitation"
finder:
fetching_contacts: "diaspora* is populating your %{service} friends, please check back in a few minutes."
service_friends: "%{service} friends"
no_friends: "No Facebook friends found."
remote_friend:
resend: "Resend"
invite: "Invite"
not_on_diaspora: "Not yet on diaspora*"
blocks:
create:
success: "All right, you wont see that user in your stream again. #silencio!"
failure: "I couldnt ignore that user. #evasion"
failure: "I couldnt ignore that user. #evasion"
destroy:
success: "Lets see what they have to say! #sayhello"
failure: "I couldnt stop ignoring that user. #evasion"
failure: "I couldnt stop ignoring that user. #evasion"
shared:
aspect_dropdown:
@ -1249,16 +1120,12 @@ en:
posting: "Posting..."
share: "Share"
preview: "Preview"
post_a_message_to: "Post a message to %{aspect}"
make_public: "Make public"
all: "All"
upload_photos: "Upload photos"
get_location: "Get your location"
remove_location: "Remove location"
all_contacts: "All contacts"
share_with: "Share with"
whats_on_your_mind: "Whats on your mind?"
publishing_to: "Publishing to: "
discard_post: "Discard post"
new_user_prefill:
newhere: "newhere"
@ -1271,21 +1138,10 @@ en:
add_a_poll: "Add a poll"
question: "Question"
option: "Option 1"
add_contact:
enter_a_diaspora_username: "Enter a diaspora* username:"
your_diaspora_username_is: "Your diaspora* username is: %{diaspora_handle}"
create_request: "Find by diaspora* ID"
diaspora_handle: "diaspora@pod.org"
know_email: "Know their email address? You should invite them"
add_new_contact: "Add a new contact"
invitations:
invites: "Invites"
invite_someone: "Invite someone"
invitations_left: "%{count} left"
dont_have_now: "You dont have any right now, but more invites are coming soon!"
invites_closed: "Invites are currently closed on this diaspora* pod"
invite_your_friends: "Invite your friends"
from_facebook: "From Facebook"
by_email: "By email"
share_this: "Share this link via email, blog, or social networks!"
reshare:
@ -1300,14 +1156,7 @@ en:
logged_in: "Logged in to %{service}"
manage: "Manage connected services"
atom_feed: "Atom feed"
notification:
new: "New %{type} from %{from}"
contact_list:
all_contacts: "All contacts"
stream_element:
viewable_to_anyone: "This post is viewable to anyone on the web"
connect_to_comment: "Connect to this user to comment on their post"
currently_unavailable: "Commenting currently unavailable"
via: "Via %{link}"
via_mobile: "Via mobile"
ignore_user: "Ignore %{name}"
@ -1315,20 +1164,12 @@ en:
hide_and_mute: "Hide and mute post"
like: "Like"
unlike: "Unlike"
dislike: "Dislike"
shared_with: "Shared with: %{aspect_names}"
nsfw: "This post has been flagged as NSFW by its author. %{link}"
show: "Show"
footer:
logged_in_as: "Logged in as %{name}"
your_aspects: "Your aspects"
status_messages:
new:
mentioning: "Mentioning: %{person}"
create:
success: "Successfully mentioned: %{names}"
helper:
no_message_to_display: "No message to display."
destroy:
failure: "Failed to delete post"
too_long: "Please make your status message fewer than %{count} characters. Right now it is %{current_length} characters"
@ -1453,7 +1294,6 @@ en:
locked_out: "You will get signed out and locked out of your account until it has been deleted."
lock_username: "Your username will be locked. You will not be able to create a new account on this pod with the same ID."
no_turning_back: "There is no turning back! If youre really sure, enter your password below."
if_you_want_this: "If you really want this to happen, type in your password below and click “Close account”"
privacy_settings:
title: "Privacy settings"
@ -1477,7 +1317,6 @@ en:
what_are_you_in_to: "What are you into?"
hashtag_explanation: "Hashtags allow you to talk about and follow your interests. Theyre also a great way to find new people on diaspora*."
hashtag_suggestions: "Try following tags like #art, #movies, #gif, etc."
saved: "Saved!"
update:
password_changed: "Password changed. You can now log in with your new password."
@ -1506,13 +1345,6 @@ en:
previous_label: "&laquo; previous"
next_label: "next &raquo;"
webfinger:
fetch_failed: "Failed to fetch webfinger profile for %{profile_url}"
hcard_fetch_failed: "There was a problem fetching the hcard for %{account}"
xrd_fetch_failed: "There was an error getting the xrd from account %{account}"
not_enabled: "Webfinger does not seem to be enabled for %{account}s host"
no_person_constructed: "No person could be constructed from this hcard."
simple_captcha:
placeholder: "Enter the image value"
label: "Enter the code in the box:"

View file

@ -92,6 +92,7 @@ en:
prefixFromNow: ""
suffixAgo: "ago"
suffixFromNow: "from now"
inPast: "any moment now"
seconds: "less than a minute"
minute: "about a minute"
minutes: "%d minutes"
@ -107,6 +108,8 @@ en:
contacts:
add_contact: "Add contact"
aspect_chat_is_enabled: "Contacts in this aspect are able to chat with you."
aspect_chat_is_not_enabled: "Contacts in this aspect are not able to chat with you."
aspect_list_is_visible: "Contacts in this aspect are able to see each other."
aspect_list_is_not_visible: "Contacts in this aspect are not able to see each other."
remove_contact: "Remove contact"
@ -118,12 +121,7 @@ en:
my_stream: "Stream"
my_aspects: "My aspects"
videos:
watch: "Watch this video on <%= provider %>"
unknown: "Unknown video type"
search_for: "Search for <%= name %>"
publisher:
at_least_one_aspect: "You must publish to at least one aspect"
limited: "Limited: your post will only be seen by people you are sharing with"
public: "Public: your post will be visible to everyone and found by search engines"
near_from: "Posted from: <%= location %>"
@ -134,9 +132,6 @@ en:
post_something: "Post to diaspora*"
post_submit: "Submitting post..."
post_success: "Posted! Closing popup window..."
infinite_scroll:
no_more: "No more posts."
no_more_contacts: "No more contacts."
aspect_dropdown:
add_to_aspect: "Add contact"
select_aspects: "Select aspects"
@ -207,7 +202,6 @@ en:
posts: "Posts"
conversation:
participants: "Participants"
new:
no_contacts: "You need to add some contacts before you can start a conversation."
@ -261,7 +255,7 @@ en:
stop_following_confirm: "Stop following #<%= tag %>?"
follow_error: "Couldnt follow #<%= tag %> :("
stop_following_error: "Couldnt stop following #<%= tag %> :("
reactions:
zero: "<%= count%> reactions"
one: "<%= count%> reaction"
@ -290,14 +284,7 @@ en:
close: "Close"
viewer:
stop_following_post: "Stop following post"
follow_post: "Follow post"
like: "Like"
unlike: "Unlike"
reshare: "Reshare"
reshared: "Reshared"
comment: "Comment"
home: "Home"
poll:
vote: "Vote"

View file

@ -0,0 +1,10 @@
require "spec_helper"
describe LanguageHelper, type: :helper do
describe "#get_javascript_strings_for" do
it "generates a jasmine fixture", fixture: true do
save_fixture(get_javascript_strings_for("en", "javascripts").to_json, "locale_en_javascripts_json")
save_fixture(get_javascript_strings_for("en", "help").to_json, "locale_en_help_json")
end
end
end

View file

@ -1,17 +1,10 @@
describe("app.collections.Aspects", function(){
beforeEach(function(){
var locale = {
and: 'and',
comma: ',',
my_aspects: 'My Aspects'
};
var my_aspects = [
{ name: 'Work', selected: true },
{ name: 'Friends', selected: false },
{ name: 'Acquaintances', selected: false }
];
Diaspora.I18n.load(locale);
this.aspects = new app.collections.Aspects(my_aspects);
});
@ -52,7 +45,7 @@ describe("app.collections.Aspects", function(){
});
it("returns the name of the aspect", function(){
expect(this.aspects.toSentence()).toEqual('My Aspects');
expect(this.aspects.toSentence()).toEqual("My aspects");
});
});

View file

@ -1,8 +1,4 @@
describe("Handlebars helpers", function() {
beforeEach(function() {
Diaspora.I18n.load({people: {helper: {"is_not_sharing": "<%= name %> is not sharing with you"}}});
});
describe("sharingMessage", function() {
it("escapes the person's name", function() {
var person = { name: "\"><script>alert(0)</script> \"><script>alert(0)</script>"};

View file

@ -3,19 +3,6 @@ describe("app.pages.AdminDashboard", function(){
spec.loadFixture("admin_dashboard");
this.view = new app.pages.AdminDashboard();
gon.podVersion = "0.5.1.2";
// disable jshint camelcase for i18n
/* jshint camelcase: false */
Diaspora.I18n.load({
admins: {
dashboard: {
up_to_date: "Your pod is up to date!",
outdated: "Your pod is outdated.",
compare_versions: "Latest d* release is <%= latestVersion%>, your pod is running <%= podVersion %>.",
error: "Unable to determine latest diaspora* version."
}
}
});
/* jshint camelcase: true */
});
describe("initialize" , function() {

View file

@ -9,14 +9,6 @@ describe("app.pages.Contacts", function(){
collection: app.contacts
}
});
Diaspora.I18n.load({
contacts: {
aspect_list_is_visible: "Contacts in this aspect are able to see each other.",
aspect_list_is_not_visible: "Contacts in this aspect are not able to see each other.",
aspect_chat_is_enabled: "Contacts in this aspect are able to chat with you.",
aspect_chat_is_not_enabled: "Contacts in this aspect are not able to chat with you.",
}
});
});
context('toggle chat privilege', function() {

View file

@ -1,20 +1,6 @@
describe("app.views.AspectCreate", function() {
beforeEach(function() {
app.events.off("aspect:create");
// disable jshint camelcase for i18n
/* jshint camelcase: false */
Diaspora.I18n.load({
aspects: {
make_aspect_list_visible: "Make contacts in this aspect visible to each other?",
name: "Name",
create: {
add_a_new_aspect: "Add a new aspect",
success: "Your new aspect <%= name %> was created",
failure: "Aspect creation failed."
}
}
});
/* jshint camelcase: true */
});
context("without a person id", function() {

View file

@ -10,14 +10,6 @@ describe("app.views.AspectMembership", function(){
app.flashMessages = new app.views.FlashMessages({ el: this.view.$("#flash-container") });
this.personId = $(".dropdown-menu").data("person_id");
this.personName = $(".dropdown-menu").data("person-short-name");
Diaspora.I18n.load({
aspect_dropdown: {
started_sharing_with: 'you started sharing with <%= name %>',
stopped_sharing_with: 'you stopped sharing with <%= name %>',
error: 'unable to add <%= name %>',
error_remove: 'unable to remove <%= name %>'
}
});
});
context('adding to aspects', function() {

View file

@ -1,15 +1,6 @@
describe("app.views.AspectsDropdown", function(){
beforeEach(function() {
spec.loadFixture("bookmarklet");
Diaspora.I18n.reset({
'aspect_dropdown': {
'select_aspects': "Select aspects",
'all_aspects': "All aspects",
'toggle': {
'zero': "Select aspects",
'one': "In <%= count %> aspect",
'other': "In <%= count %> aspects"
}}});
this.view = new app.views.AspectsDropdown({el: $('.aspect_dropdown')});
});

View file

@ -1,11 +1,6 @@
describe("app.views.AspectsList", function(){
beforeEach(function(){
setFixtures('<ul id="aspects_list"></ul>');
Diaspora.I18n.load({ aspect_navigation : {
'select_all' : 'Select all',
'deselect_all' : 'Deselect all'
}});
var aspects = [{ name: 'Work', selected: true },
{ name: 'Friends', selected: false },
{ name: 'Acquaintances', selected: false }];

View file

@ -50,14 +50,12 @@ describe("app.views.CommentStream", function(){
});
it("doesn't add the comment to the view, when the request fails", function(){
// disable jshint camelcase for i18n
/* jshint camelcase: false */
Diaspora.I18n.load({failed_to_comment: "posting failed!"});
/* jshint camelcase: true */
this.request.respondWith({status: 500});
expect(this.view.$(".comment-content p").text()).not.toEqual("a new comment");
expect(this.view.$(".flash-message")).toBeErrorFlashMessage("posting failed!");
expect(this.view.$(".flash-message")).toBeErrorFlashMessage(
"Failed to comment. Maybe the author is ignoring you?"
);
});
});

View file

@ -9,14 +9,6 @@ describe("app.views.Contact", function(){
aspect_memberships: [{id: 23, aspect: this.aspect1}]
});
this.view = new app.views.Contact({ model: this.model });
Diaspora.I18n.load({
contacts: {
add_contact: "Add contact",
remove_contact: "Remove contact",
error_add: "Couldn't add <%= name %> to the aspect :(",
error_remove: "Couldn't remove <%= name %> from the aspect :("
}
});
});
context("#presenter", function() {

View file

@ -2,14 +2,6 @@ describe("app.views.Feedback", function(){
beforeEach(function(){
this.userAttrs = _.extend(factory.userAttrs(), {guid : -1});
loginAs(this.userAttrs);
Diaspora.I18n.load({stream : {
'like' : "Like",
'unlike' : "Unlike",
'public' : "Public",
'limited' : "Limted"
}});
var posts = $.parseJSON(spec.readFixture("stream_json"));
this.post = new app.models.Post(posts[0]);

File diff suppressed because one or more lines are too long

View file

@ -66,14 +66,14 @@ describe("app.views.Notifications", function(){
this.view.updateView(this.readN.data("guid"), this.readN.data("type"), true);
expect(this.readN.hasClass("unread")).toBeTruthy();
expect(this.readN.hasClass("read")).toBeFalsy();
expect(this.readN.find(".unread-toggle .entypo-eye").data("original-title")).toBe(
expect(this.readN.find(".unread-toggle .entypo-eye").attr("data-original-title")).toBe(
Diaspora.I18n.t("notifications.mark_read")
);
this.view.updateView(this.readN.data("guid"), this.readN.data("type"), false);
expect(this.readN.hasClass("read")).toBeTruthy();
expect(this.readN.hasClass("unread")).toBeFalsy();
expect(this.readN.find(".unread-toggle .entypo-eye").data("original-title")).toBe(
expect(this.readN.find(".unread-toggle .entypo-eye").attr("data-original-title")).toBe(
Diaspora.I18n.t("notifications.mark_unread")
);
});

View file

@ -1,7 +1,7 @@
describe("app.views.PodEntry", function() {
beforeEach(function() {
this.pod = new app.models.Pod({id : 123});
this.pod = factory.pod();
this.view = new app.views.PodEntry({
model: this.pod,
parent: document.createDocumentFragment()

View file

@ -45,12 +45,6 @@ describe("app.views.Poll", function(){
describe("reshared post", function(){
beforeEach(function(){
Diaspora.I18n.load({
poll: {
go_to_original_post: "You can participate in this poll on the <%= original_post_link %>.",
original_post: "original post"
}
});
this.view.model.attributes.post_type = "Reshare";
this.view.model.attributes.root = {id: 1};
this.view.render();

View file

@ -262,10 +262,6 @@ describe("app.views.Publisher", function() {
});
describe("_beforeUnload", function(){
beforeEach(function(){
Diaspora.I18n.load({ confirm_unload: "Please confirm that you want to leave this page - data you have entered won't be saved."});
});
it("calls _submittable", function(){
spyOn(this.view, "_submittable");
$(window).trigger('beforeunload');
@ -366,7 +362,6 @@ describe("app.views.Publisher", function() {
beforeEach( function(){
loginAs({name: "alice", avatar : {small : "http://avatar.com/photo.jpg"}});
spec.loadFixture("status_message_new");
Diaspora.I18n.load({ stream: { public: 'Public' }});
this.viewAspectSelector = new app.views.PublisherAspectSelector({
el: $(".public_toggle .aspect_dropdown"),
@ -559,7 +554,6 @@ describe("app.views.Publisher", function() {
context('successful completion', function() {
beforeEach(function() {
Diaspora.I18n.load({ photo_uploader: { completed: '<%= file %> completed' }});
$('#photodropzone').html('<li class="publisher_photo loading"><img src="" /></li>');
this.uploader.onComplete(null, 'test.jpg', {
@ -597,7 +591,6 @@ describe("app.views.Publisher", function() {
context('unsuccessful completion', function() {
beforeEach(function() {
Diaspora.I18n.load({ photo_uploader: { completed: '<%= file %> completed' }});
$('#photodropzone').html('<li class="publisher_photo loading"><img src="" /></li>');
this.uploader.onComplete(null, 'test.jpg', {

View file

@ -53,18 +53,6 @@ describe("app.views.StreamPost", function(){
beforeEach(function(){
loginAs({name: "alice", avatar : {small : "http://avatar.com/photo.jpg"}});
Diaspora.I18n.load({stream : {
reshares : {
one : "<%= count %> reshare",
other : "<%= count %> reshares"
},
likes : {
zero : "<%= count %> Likes",
one : "<%= count %> Like",
other : "<%= count %> Likes"
}
}});
});
context("reshares", function(){

View file

@ -24,6 +24,10 @@ describe("Diaspora.I18n", function() {
Diaspora.I18n.reset(); // run tests with clean locale
});
afterEach(function() {
Diaspora.I18n.load(spec.defaultLocale, "en"); // leave the tests with the default locale
});
describe("::load", function() {
it("sets the class's locale variable", function() {
Diaspora.I18n.load(locale, "en", locale);
@ -65,8 +69,10 @@ describe("Diaspora.I18n", function() {
expect(translation).toEqual("it works!");
});
it("returns an empty string if the translation is not found", function() {
expect(Diaspora.I18n.t("missing.locale")).toEqual("");
it("throws an error if the translation is not found", function() {
expect(function() {
return Diaspora.I18n.t("missing.locale");
}).toThrowError("Missing translation: missing.locale");
});
it("falls back on missing key", function() {

View file

@ -37,7 +37,6 @@ var customMatchers = {
}
};
beforeEach(function() {
jasmine.clock().install();
jasmine.Ajax.install();
@ -52,8 +51,6 @@ beforeEach(function() {
var Page = Diaspora.Pages["TestPage"];
$.extend(Page.prototype, Diaspora.EventBroker.extend(Diaspora.BaseWidget));
Diaspora.I18n.load({}, "en", {});
Diaspora.page = new Page();
Diaspora.page.publish("page/ready", [$(document.body)]);
@ -74,8 +71,6 @@ beforeEach(function() {
});
afterEach(function() {
//spec.clearLiveEventBindings();
jasmine.clock().uninstall();
jasmine.Ajax.uninstall();
@ -107,42 +102,6 @@ window.logout = function logout(){
return app.currentUser;
};
window.hipsterIpsumFourParagraphs = "Mcsweeney's mumblecore irony fugiat, ex iphone brunch helvetica eiusmod retro" +
" sustainable mlkshk. Pop-up gentrify velit readymade ad exercitation 3 wolf moon. Vinyl aute laboris artisan irony, " +
"farm-to-table beard. Messenger bag trust fund pork belly commodo tempor street art, nihil excepteur PBR lomo laboris." +
" Cosby sweater american apparel occupy, locavore odio put a bird on it fixie kale chips. Pariatur semiotics flexitarian " +
"veniam, irure freegan irony tempor. Consectetur sriracha pour-over vice, umami exercitation farm-to-table master " +
"cleanse art party." + "\n" +
"Quinoa nostrud street art helvetica et single-origin coffee, stumptown bushwick selvage skateboard enim godard " +
"before they sold out tumblr. Portland aesthetic freegan pork belly, truffaut occupy assumenda banksy 3 wolf moon " +
"irure forage terry richardson nulla. Anim nostrud selvage sartorial organic. Consequat pariatur aute fugiat qui, " +
"organic marfa sunt gluten-free mcsweeney's elit hella whatever wayfarers. Leggings pariatur chambray, ullamco " +
"flexitarian esse sed iphone pinterest messenger bag Austin cred DIY. Duis enim squid mcsweeney's, nisi lo-fi " +
"sapiente. Small batch vegan thundercats locavore williamsburg, non aesthetic trust fund put a bird on it gluten-free " +
"consectetur." + "\n" +
"Viral reprehenderit iphone sapiente exercitation. Enim nostrud letterpress, tempor typewriter dreamcatcher tattooed." +
" Ex godard pariatur voluptate est, polaroid hoodie ea nulla umami pickled tempor portland. Nostrud food truck" +
"single-origin coffee skateboard. Fap enim tumblr retro, nihil twee trust fund pinterest non jean shorts veniam " +
"fingerstache small batch. Cred whatever photo booth sed, et dolore gastropub duis freegan. Authentic quis butcher, " +
"fanny pack art party cupidatat readymade semiotics kogi consequat polaroid shoreditch ad four loko." + "\n" +
"PBR gluten-free ullamco exercitation narwhal in godard occaecat bespoke street art veniam aesthetic jean shorts " +
"mlkshk assumenda. Typewriter terry richardson pork belly, cupidatat tempor craft beer tofu sunt qui gentrify eiusmod " +
"id. Letterpress pitchfork wayfarers, eu sunt lomo helvetica pickled dreamcatcher bicycle rights. Aliqua banksy " +
"cliche, sapiente anim chambray williamsburg vinyl cardigan. Pork belly mcsweeney's anim aliqua. DIY vice portland " +
"thundercats est vegan etsy, gastropub helvetica aliqua. Artisan jean shorts american apparel duis esse trust fund.";
spec.clearLiveEventBindings = function() {
var events = jQuery.data(document, "events");
for (var prop in events) {
if(events.hasOwnProperty(prop)) {
delete events[prop];
}
}
};
spec.content = function() {
return $("#jasmine_content");
};
@ -195,6 +154,8 @@ spec.retrieveFixture = function(fixtureName) {
return xhr.responseText;
};
spec.loadFixtureCount = 0;
spec.cachedFixtures = {};
spec.defaultLocale = JSON.parse(spec.readFixture("locale_en_javascripts_json"));
Diaspora.I18n.reset(spec.defaultLocale);

View file

@ -211,6 +211,24 @@ var factory = {
window.gon = { preloads: {} };
_.extend(window.gon.preloads, defaults, overrides);
},
pod: function(overrides) {
var defaultAttrs = {
"id": 4,
"host": "pod.example.org",
"port": null,
"ssl": true,
"status": "no_errors",
"checked_at": "2020-01-01T13:37:00.000Z",
"response_time": 100,
"offline": false,
"offline_since": null,
"created_at": "2010-01-01T13:37:00.000Z",
"software": "diaspora 1.2.3.0",
"error": "ConnectionTester::Failure: #<Faraday::TimeoutError>"
};
return new app.models.Pod(_.extend(defaultAttrs, overrides));
}
};

View file

@ -15,15 +15,15 @@ describe "i18n interpolation fallbacks" do
end
describe "when string requires interpolation arguments" do
context "current locale has no fallbacks" do
# ago: "%{time} ago" (in en.yml)
# tags.show.follow: "Follow #%{tag}" (in en.yml)
it "returns the translation when all arguments are provided" do
expect(I18n.t('ago', :time => "2 months")).to eq("2 months ago")
expect(I18n.t("tags.show.follow", tag: "cats")).to eq("Follow #cats")
end
it "returns the translation without substitution when all arguments are omitted" do
expect(I18n.t('ago')).to eq("%{time} ago")
expect(I18n.t("tags.show.follow")).to eq("Follow #%{tag}")
end
it "raises a MissingInterpolationArgument when arguments are wrong" do
expect { I18n.t('ago', :not_time => "2 months") }.to raise_exception(I18n::MissingInterpolationArgument)
expect { I18n.t("tags.show.follow", not_tag: "cats") }.to raise_exception(I18n::MissingInterpolationArgument)
end
end
context "current locale falls back to English" do

View file

@ -44,3 +44,6 @@ RSpec::Rails::ControllerExampleGroup.class_eval do
include JasmineFixtureGeneration
end
RSpec::Rails::HelperExampleGroup.class_eval do
include JasmineFixtureGeneration
end