From 7e8f4286e3dbe26283c409e85668282545012128 Mon Sep 17 00:00:00 2001 From: Kane York Date: Wed, 16 Sep 2015 17:28:33 -0700 Subject: [PATCH] FEATURE: Allow emoji in some translated strings --- app/assets/javascripts/discourse/helpers/i18n.js.es6 | 4 ++++ .../javascripts/discourse/templates/components/signup-cta.hbs | 4 ++-- config/locales/client.en.yml | 4 ++-- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/app/assets/javascripts/discourse/helpers/i18n.js.es6 b/app/assets/javascripts/discourse/helpers/i18n.js.es6 index b19eae3b58c..ebe7ba6e518 100644 --- a/app/assets/javascripts/discourse/helpers/i18n.js.es6 +++ b/app/assets/javascripts/discourse/helpers/i18n.js.es6 @@ -3,3 +3,7 @@ import registerUnbound from 'discourse/helpers/register-unbound'; registerUnbound('i18n', function(key, params) { return I18n.t(key, params); }); + +registerUnbound('replace-emoji', function(text) { + return new Handlebars.SafeString(Discourse.Emoji.unescape(text)); +}); diff --git a/app/assets/javascripts/discourse/templates/components/signup-cta.hbs b/app/assets/javascripts/discourse/templates/components/signup-cta.hbs index 818f66cd841..721c38158ea 100644 --- a/app/assets/javascripts/discourse/templates/components/signup-cta.hbs +++ b/app/assets/javascripts/discourse/templates/components/signup-cta.hbs @@ -5,8 +5,8 @@ {{i18n "signup_cta.hide_forever"}}

{{else}} -

{{i18n "signup_cta.intro"}}

-

{{i18n "signup_cta.value_prop"}}

+

{{replace-emoji (i18n "signup_cta.intro")}}

+

{{replace-emoji (i18n "signup_cta.value_prop")}}

{{signupMethodsTranslated}}

diff --git a/config/locales/client.en.yml b/config/locales/client.en.yml index d53a4a265d9..103899efaad 100644 --- a/config/locales/client.en.yml +++ b/config/locales/client.en.yml @@ -729,8 +729,8 @@ en: hide_session: "Remind me tomorrow" hide_forever: "Never show this again" hidden_for_session: "OK, I'll ask you tomorrow. You can always click the 'Log In' button to create an account, too." - intro: Hey there! ? Looks like you're enjoying the discussion, but you're not signed up for an account. - value_prop: When you create an account, we can track exactly what you've read, so you always come right back where you left off. You can also get notifications, here and via email, whenever new posts are made. And you can like posts to share the love. 💘 + intro: "Hey there! :heart_eyes: Looks like you're enjoying the discussion, but you're not signed up for an account." + value_prop: "When you create an account, we can track exactly what you've read, so you always come right back where you left off. You can also get notifications, here and via email, whenever new posts are made. And you can like posts to share the love. :heartbeat:" methods: sso: "Signing up is easy: all you need is an account on the main site." only_email: "Signing up is easy: all you need is an email and password."