Constantize broadcast messages (#16219)

This commit is contained in:
Josh Puetz 2022-01-20 11:47:01 -06:00 committed by GitHub
parent 53564c2849
commit 4f24c5ff43
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 65 additions and 117 deletions

View file

@ -3,6 +3,23 @@ en:
create_mascot:
name: Mascot
error: Mascot already set
broadcast:
welcome:
ask_question: "Sloan here! 👋 I noticed that you haven't <a href='https://dev.to/t/explainlikeimfive'>asked a question</a> yet. Asking a question is easy to do; just click on 'Create Post' in the sidebar of the tag page to get started!"
customize_experience: "Sloan here! 👋 Did you know that that you can customize your DEV experience? Try changing <a href='settings/customization'>your font and theme</a> and find the best style for you!"
customize_feed: "Hi, it's me again! 👋 Now that you're a part of the DEV community, let's focus on personalizing your content. You can start by <a href='/tags'>following some tags</a> to help customize your feed! 🎉"
discuss_and_ask: "Sloan here! 👋 I noticed that you haven't <a href='https://dev.to/t/explainlikeimfive'>asked a question</a> or <a href='https://dev.to/t/discuss'>started a discussion</a> yet. It's easy to do both of these; just click on 'Create Post' in the sidebar of the tag page to get started!"
download_app: "Sloan here, with one last tip! 👋 Have you downloaded the DEV mobile app yet? Consider <a href='https://dev.to/downloads'>downloading</a> it so you can access all of your favorite DEV content on the go!"
set_up_profile: "Welcome to DEV! 👋 I'm Sloan, the community mascot and I'm here to help get you started. Let's begin by <a href='/settings'>setting up your profile</a>!"
start_discussion: "Sloan here! 👋 I noticed that you haven't <a href='https://dev.to/t/discuss'>started a discussion</a> yet. Starting a discussion is easy to do; just click on 'Create Post' in the sidebar of the tag page to get started!"
welcome_thread: "Sloan here again! 👋 DEV is a friendly community. Why not introduce yourself by leaving a comment in <a href='/welcome'>the welcome thread</a>!"
connect:
apple: "You're on a roll! 🎉 Do you have an Apple account? Consider <a href='/settings'>connecting it</a>."
facebook: "You're on a roll! 🎉 Do you have a Facebook account? Consider <a href='/settings'>connecting it</a>."
forem: "You're on a roll! 🎉 Do you have a Forem account? Consider <a href='/settings'>connecting it</a>."
github: "You're on a roll! 🎉 Do you have a GitHub account? Consider <a href='/settings'>connecting it</a> so you can pin any of your repos to your profile."
google: "You're on a roll! 🎉 Do you have a Google account? Consider <a href='/settings'>connecting it</a>."
twitter: "You're on a roll! 🎉 Do you have a Twitter account? Consider <a href='/settings'>connecting it</a> so we can @mention you if we share your post via our Twitter account <a href='https://twitter.com/thePracticalDev'>@thePracticalDev</a>."
errors:
authentication:
errors:

View file

@ -3,6 +3,23 @@ fr:
create_mascot:
name: Mascot
error: Mascot already set
broadcast:
welcome:
ask_question: "Sloan here! 👋 I noticed that you haven't <a href='https://dev.to/t/explainlikeimfive'>asked a question</a> yet. Asking a question is easy to do; just click on 'Create Post' in the sidebar of the tag page to get started!"
customize_experience: "Sloan here! 👋 Did you know that that you can customize your DEV experience? Try changing <a href='settings/customization'>your font and theme</a> and find the best style for you!"
customize_feed: "Hi, it's me again! 👋 Now that you're a part of the DEV community, let's focus on personalizing your content. You can start by <a href='/tags'>following some tags</a> to help customize your feed! 🎉"
discuss_and_ask: "Sloan here! 👋 I noticed that you haven't <a href='https://dev.to/t/explainlikeimfive'>asked a question</a> or <a href='https://dev.to/t/discuss'>started a discussion</a> yet. It's easy to do both of these; just click on 'Create Post' in the sidebar of the tag page to get started!"
download_app: "Sloan here, with one last tip! 👋 Have you downloaded the DEV mobile app yet? Consider <a href='https://dev.to/downloads'>downloading</a> it so you can access all of your favorite DEV content on the go!"
set_up_profile: "Welcome to DEV! 👋 I'm Sloan, the community mascot and I'm here to help get you started. Let's begin by <a href='/settings'>setting up your profile</a>!"
start_discussion: "Sloan here! 👋 I noticed that you haven't <a href='https://dev.to/t/discuss'>started a discussion</a> yet. Starting a discussion is easy to do; just click on 'Create Post' in the sidebar of the tag page to get started!"
welcome_thread: "Sloan here again! 👋 DEV is a friendly community. Why not introduce yourself by leaving a comment in <a href='/welcome'>the welcome thread</a>!"
connect:
apple: "You're on a roll! 🎉 Do you have an Apple account? Consider <a href='/settings'>connecting it</a>."
facebook: "You're on a roll! 🎉 Do you have a Facebook account? Consider <a href='/settings'>connecting it</a>."
forem: "You're on a roll! 🎉 Do you have a Forem account? Consider <a href='/settings'>connecting it</a>."
github: "You're on a roll! 🎉 Do you have a GitHub account? Consider <a href='/settings'>connecting it</a> so you can pin any of your repos to your profile."
google: "You're on a roll! 🎉 Do you have a Google account? Consider <a href='/settings'>connecting it</a>."
twitter: "You're on a roll! 🎉 Do you have a Twitter account? Consider <a href='/settings'>connecting it</a> so we can @mention you if we share your post via our Twitter account <a href='https://twitter.com/thePracticalDev'>@thePracticalDev</a>."
errors:
authentication:
errors:

View file

@ -358,43 +358,19 @@ end
seeder.create_if_none(Broadcast) do
broadcast_messages = {
set_up_profile: "Welcome to DEV! 👋 I'm Sloan, the community mascot and I'm here to help get you started. " \
"Let's begin by <a href='/settings'>setting up your profile</a>!",
welcome_thread: "Sloan here again! 👋 DEV is a friendly community. " \
"Why not introduce yourself by leaving a comment in <a href='/welcome'>the welcome thread</a>!",
twitter_connect: "You're on a roll! 🎉 Do you have a Twitter account? " \
"Consider <a href='/settings'>connecting it</a> so we can @mention you if we share your post " \
"via our Twitter account <a href='https://twitter.com/thePracticalDev'>@thePracticalDev</a>.",
facebook_connect: "You're on a roll! 🎉 Do you have a Facebook account? " \
"Consider <a href='/settings'>connecting it</a>.",
github_connect: "You're on a roll! 🎉 Do you have a GitHub account? " \
"Consider <a href='/settings'>connecting it</a> so you can pin any of your repos to your profile.",
google_oauth2_connect: "You're on a roll! 🎉 Do you have a Google account? " \
"Consider <a href='/settings'>connecting it</a>.",
apple_connect: "You're on a roll! 🎉 Do you have an Apple account? " \
"Consider <a href='/settings'>connecting it</a>.",
customize_feed:
"Hi, it's me again! 👋 Now that you're a part of the DEV community, let's focus on personalizing " \
"your content. You can start by <a href='/tags'>following some tags</a> to help customize your feed! 🎉",
customize_experience:
"Sloan here! 👋 Did you know that that you can customize your DEV experience? " \
"Try changing <a href='settings/customization'>your font and theme</a> and find the best style for you!",
start_discussion:
"Sloan here! 👋 I noticed that you haven't " \
"<a href='https://dev.to/t/discuss'>started a discussion</a> yet. Starting a discussion is easy to do; " \
"just click on 'Create Post' in the sidebar of the tag page to get started!",
ask_question:
"Sloan here! 👋 I noticed that you haven't " \
"<a href='https://dev.to/t/explainlikeimfive'>asked a question</a> yet. Asking a question is easy to do; " \
"just click on 'Create Post' in the sidebar of the tag page to get started!",
discuss_and_ask:
"Sloan here! 👋 I noticed that you haven't " \
"<a href='https://dev.to/t/explainlikeimfive'>asked a question</a> or " \
"<a href='https://dev.to/t/discuss'>started a discussion</a> yet. It's easy to do both of these; " \
"just click on 'Create Post' in the sidebar of the tag page to get started!",
download_app: "Sloan here, with one last tip! 👋 Have you downloaded the DEV mobile app yet? " \
"Consider <a href='https://dev.to/downloads'>downloading</a> it so you can access all " \
"of your favorite DEV content on the go!"
set_up_profile: I18n.t("broadcast.welcome.set_up_profile"),
welcome_thread: I18n.t("broadcast.welcome.welcome_thread"),
twitter_connect: I18n.t("broadcast.connect.twitter"),
facebook_connect: I18n.t("broadcast.connect.facebook"),
github_connect: I18n.t("broadcast.connect.github"),
google_oauth2_connect: I18n.t("broadcast.connect.google"),
apple_connect: I18n.t("broadcast.connect.apple"),
customize_feed: I18n.t("broadcast.welcome.customize_feed"),
customize_experience: I18n.t("broadcast.welcome.customize_experience"),
start_discussion: I18n.t("broadcast.welcome.start_discussion"),
ask_question: I18n.t("broadcast.welcome.ask_question"),
discuss_and_ask: I18n.t("broadcast.welcome.discuss_and_ask"),
download_app: I18n.t("broadcast.welcome.download_app"),
}
broadcast_messages.each do |type, message|

View file

@ -3,12 +3,9 @@ module DataUpdateScripts
def run
return if Broadcast.find_by title: "Welcome Notification: facebook_connect"
message = "You're on a roll! 🎉 Do you have a Facebook account? " \
"Consider <a href='/settings'>connecting it</a>."
Broadcast.create!(
title: "Welcome Notification: facebook_connect",
processed_html: message,
processed_html: I18n.t("broadcast.connect.facebook"),
type_of: "Welcome",
active: true,
)

View file

@ -3,12 +3,9 @@ module DataUpdateScripts
def run
return if Broadcast.find_by(title: "Welcome Notification: forem_connect")
message = "You're on a roll! 🎉 Do you have a Forem account? " \
"Consider <a href='/settings'>connecting it</a>."
Broadcast.create!(
title: "Welcome Notification: forem_connect",
processed_html: message,
processed_html: I18n.t("broadcast.connect.forem"),
type_of: "Welcome",
active: true,
)

View file

@ -3,12 +3,9 @@ module DataUpdateScripts
def run
return if Broadcast.find_by(title: "Welcome Notification: google_oauth2_connect")
message = "You're on a roll! 🎉 Do you have a Google account? " \
"Consider <a href='/settings'>connecting it</a>."
Broadcast.create!(
title: "Welcome Notification: google_oauth2_connect",
processed_html: message,
processed_html: I18n.t("broadcast.connect.google"),
type_of: "Welcome",
active: true,
)

View file

@ -4,12 +4,9 @@ module DataUpdateScripts
title = "Welcome Notification: apple_connect"
return if Broadcast.find_by title: title
message = "You're on a roll! 🎉 Do you have an Apple account? " \
"Consider <a href='/settings'>connecting it</a>."
Broadcast.create!(
title: title,
processed_html: message,
processed_html: I18n.t("broadcast.connect.apple"),
type_of: "Welcome",
active: true,
)

View file

@ -6,135 +6,85 @@ FactoryBot.define do
factory :set_up_profile_broadcast do
title { "Welcome Notification: set_up_profile" }
type_of { "Welcome" }
processed_html do
"Welcome to DEV! 👋 I'm <a href='https://dev.to/sloan'>Sloan</a>, " \
"the community mascot and I'm here to help get you started. " \
"Let's begin by <a href='https://dev.to/settings'>setting up your profile</a>!"
end
processed_html { I18n.t("broadcast.welcome.set_up_profile") }
end
factory :welcome_broadcast do
title { "Welcome Notification: welcome_thread" }
type_of { "Welcome" }
processed_html do
"Sloan here again! 👋 DEV is a friendly community. " \
"Why not introduce yourself by leaving a comment in <a href='/welcome'>the welcome thread</a>!"
end
processed_html { I18n.t("broadcast.welcome.welcome_thread") }
end
factory :apple_connect_broadcast do
title { "Welcome Notification: apple_connect" }
type_of { "Welcome" }
processed_html do
"You're on a roll! 🎉 Do you have an Apple account? Consider <a href='/settings'>connecting it</a>."
end
processed_html { I18n.t("broadcast.connect.apple") }
end
factory :github_connect_broadcast do
title { "Welcome Notification: github_connect" }
type_of { "Welcome" }
processed_html do
"You're on a roll! 🎉 Do you have a GitHub account? Consider " \
"<a href='/settings'>connecting it</a> so you can pin any of your repos to your profile."
end
processed_html { I18n.t("broadcast.connect.github") }
end
factory :google_oauth2_connect_broadcast do
title { "Welcome Notification: google_oauth2_connect" }
type_of { "Welcome" }
processed_html do
"You're on a roll! 🎉 Do you have a Google account? Consider " \
"<a href='/settings'>connecting it</a>."
end
processed_html { I18n.t("broadcast.connect.google") }
end
factory :facebook_connect_broadcast do
title { "Welcome Notification: facebook_connect" }
type_of { "Welcome" }
processed_html do
"You're on a roll! 🎉 Do you have a Facebook account? Consider " \
"<a href='/settings'>connecting it</a>."
end
processed_html { I18n.t("broadcast.connect.facebook") }
end
factory :forem_connect_broadcast do
title { "Welcome Notification: forem_connect" }
type_of { "Welcome" }
processed_html do
"You're on a roll! 🎉 Do you have a Forem account? Consider " \
"<a href='/settings'>connecting it</a>."
end
processed_html { I18n.t("broadcast.connect.forem") }
end
factory :twitter_connect_broadcast do
title { "Welcome Notification: twitter_connect" }
type_of { "Welcome" }
processed_html do
"You're on a roll! 🎉 Do you have a Twitter account? Consider " \
"<a href='/settings'>connecting it</a> so we can @mention you if we share " \
"your post via our Twitter account <a href='https://twitter.com/thePracticalDev'>@thePracticalDev</a>."
end
processed_html { I18n.t("broadcast.connect.twitter") }
end
factory :customize_ux_broadcast do
title { "Welcome Notification: customize_experience" }
type_of { "Welcome" }
processed_html do
"Sloan here! 👋 Did you know that that you can customize your DEV experience? " \
"Try changing <a href='settings/customization'>your font and theme</a> and find the best style for you!"
end
processed_html { I18n.t("broadcast.welcome.customize_experience") }
end
factory :customize_feed_broadcast do
title { "Welcome Notification: customize_feed" }
type_of { "Welcome" }
processed_html do
"Hi, it's me again! 👋 Now that you're a part of the DEV community, " \
"let's focus on personalizing your content. You can start by " \
"<a href='/tags'>following some tags</a> to help customize your feed! 🎉"
end
processed_html { I18n.t("broadcast.welcome.customize_feed") }
end
factory :start_discussion_broadcast do
title { "Welcome Notification: start_discussion" }
type_of { "Welcome" }
processed_html do
"Sloan here! 👋 I noticed that you haven't " \
"<a href='https://dev.to/t/discuss'>started a discussion</a> yet. " \
"Starting a discussion is easy to do; just click on 'Create Post' " \
"in the sidebar of the tag page to get started!"
end
processed_html { I18n.t("broadcast.welcome.start_discussion") }
end
factory :ask_question_broadcast do
title { "Welcome Notification: ask_question" }
type_of { "Welcome" }
processed_html do
"Sloan here! 👋 I noticed that you haven't " \
"<a href='https://dev.to/t/explainlikeimfive'>asked a question</a> yet. " \
"Asking a question is easy to do; just click on 'Create Post' in the sidebar of the tag page to get started!"
end
processed_html { I18n.t("broadcast.welcome.ask_question") }
end
factory :discuss_and_ask_broadcast do
title { "Welcome Notification: discuss_and_ask" }
type_of { "Welcome" }
processed_html do
"Sloan here! 👋 I noticed that you haven't " \
"<a href='https://dev.to/t/explainlikeimfive'>asked a question</a> or " \
"<a href='https://dev.to/t/discuss'>started a discussion</a> yet. " \
"It's easy to do both of these; just click on 'Create Post' in the sidebar of the tag page to get started!"
end
processed_html { I18n.t("broadcast.welcome.discuss_and_ask") }
end
factory :download_app_broadcast do
title { "Welcome Notification: download_app" }
type_of { "Welcome" }
processed_html do
"Sloan here, with one last tip! 👋 Have you downloaded the DEV mobile " \
"app yet? Consider <a href='https://dev.to/downloads'>downloading</a> it " \
"so you can access all of your favorite DEV content on the go!"
end
processed_html { I18n.t("broadcast.welcome.download_app") }
end
factory :announcement_broadcast do