From fcc5d024cc9095c6a6c7f64f380e43fcf2aaa483 Mon Sep 17 00:00:00 2001 From: SleepWalker Date: Sat, 24 Sep 2016 15:19:33 +0300 Subject: [PATCH] Localization support for images --- src/components/text/BitmapText.jsx | 21 +++-- src/emails/register/Register.jsx | 83 +++++------------- .../register/images/be/confirmEmail.png | Bin 3609 -> 0 bytes .../register/images/en/confirmEmail.png | Bin 2601 -> 0 bytes .../register/images/ru/confirmEmail.png | Bin 3738 -> 0 bytes 5 files changed, 36 insertions(+), 68 deletions(-) delete mode 100644 src/emails/register/images/be/confirmEmail.png delete mode 100644 src/emails/register/images/en/confirmEmail.png delete mode 100644 src/emails/register/images/ru/confirmEmail.png diff --git a/src/components/text/BitmapText.jsx b/src/components/text/BitmapText.jsx index 6fee920..8200fff 100644 --- a/src/components/text/BitmapText.jsx +++ b/src/components/text/BitmapText.jsx @@ -13,10 +13,17 @@ export function BitmapText(props) { throw new Error('The message.id must be contain 3 parts separated by dots'); } - const src = require(`emails/${parts[1]}/images/${props.intl.locale}/${parts[2]}.png`); - // TODO: we can improve this loader in future by adding an option to disable file emitting - // because this thing is handled by url-loader - const size = require(`image-size!emails/${parts[1]}/images/${props.intl.locale}/${parts[2]}.png`); + let src; + let size; + try { + src = require(`emails/${parts[1]}/images/${props.intl.locale}/${parts[2]}.png`); + // TODO: we can improve this loader in future by adding an option to disable file emitting + // because this thing is handled by url-loader + size = require(`image-size!emails/${parts[1]}/images/${props.intl.locale}/${parts[2]}.png`); + } catch (err) { // fallback to default locale + src = require(`emails/${parts[1]}/images/${props.intl.defaultLocale}/${parts[2]}.png`); + size = require(`image-size!emails/${parts[1]}/images/${props.intl.defaultLocale}/${parts[2]}.png`); + } const width = props.retina ? size.width / 2 : size.width; const height = props.retina ? size.height / 2 : size.height; @@ -26,7 +33,7 @@ export function BitmapText(props) { {message} } ); @@ -39,11 +46,13 @@ BitmapText.propTypes = { id: PropTypes.string }) ]).isRequired, + style: PropTypes.object, // eslint-disable-line react/forbid-prop-types retina: PropTypes.bool }; BitmapText.defaultProps = { - retina: true + retina: true, + style: {} }; import { injectIntl, intlShape } from 'react-intl'; diff --git a/src/emails/register/Register.jsx b/src/emails/register/Register.jsx index 8135ddc..2415b0e 100644 --- a/src/emails/register/Register.jsx +++ b/src/emails/register/Register.jsx @@ -15,13 +15,6 @@ import violetManImage from './images/violetMan.png'; import orangeManImage from './images/orangeMan.png'; import darkBlueManImage from './images/darkBlueMan.png'; -import confirmEmailImage from './images/ru/confirmEmail.png'; -import whatsNextImage from './images/ru/whatsNext.png'; -import chooseYouSkin from './images/ru/chooseYouSkin.png'; -import installOurPatch from './images/ru/installOurPatch.png'; -import useTLauncher from './images/ru/useTlauncher.png'; -import footerLogoImage from './images/ru/footerLogo.png'; - export default function Register({username, link, code}) { return (
@@ -33,7 +26,9 @@ export default function Register({username, link, code}) {
- + @@ -54,15 +49,9 @@ export default function Register({username, link, code}) { }}> @@ -96,15 +85,9 @@ export default function Register({username, link, code}) { ...styles.contentCenterCell, ...styles.whatsNextText }}> - {/* TODO: текст и картинка */} - {(message) => - {message} - } + @@ -118,15 +101,9 @@ export default function Register({username, link, code}) { }} /> - {/* TODO: текст и картинка */} - {(message) => - {message} - } +
- {/* TODO: текст и картинка */} - {(message) => - {message} - } +
- {/* TODO: текст и картинка */} - {(message) => - {message} - } +
- {/* TODO: текст и картинка */} - {(message) => - {message} - } + diff --git a/src/emails/register/images/be/confirmEmail.png b/src/emails/register/images/be/confirmEmail.png deleted file mode 100644 index d0868fd17f30b1dcfde185da1221e74af43277a3..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 3609 zcmV+!4(9QRP)Px?(@8`@RCodHoD0xZRTalUAW|_i6&2J$#S|-3RGvZ#YR&jedpKzlrcIWk+ZYHeSYVh`+eV8 zGyl8SUTf{w+V6Ajy$UAY#1;u4%Aw z_jK*r_1OmV$dk8o4=|SYq6s&FeZb|6i6`50lW0$W>VIh+ZTKZ^pH)Y?c9W#;z9!*r zpi%mI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aJuXc(@}0aksn6^$!sGIofudx?LRR$aV4Jsi z^jY+!`tf>THxa*T!8mE`uf>U0O;-jpEF&amJ05hBEFo-qdNr^w6k6@EIosH211lnQ z4bM&TDBIU6(6_0%1Bz;0A;JpZg2{2d&u1?CB`PWqaoh~91rx?sApV0==Ara zj`oYQvvQ1gb_t@e=!9c!#bdK4(0}QS0)^jk`8G+$DRT^Plv-aV*`{X88|S7rH%pGh zNjZZRRZqp|L`bTbP`08Bg$Kh zfqg@0#7)C?mcDEnhvyaPpdR4uK=3V92W@WNtlR@l_3wL~t~*$8j-=6jqlRbt-@Bd8 f`FVpg@xcE8qxES6mLIzo00000NkvXXu0mjf_*(Fc diff --git a/src/emails/register/images/en/confirmEmail.png b/src/emails/register/images/en/confirmEmail.png deleted file mode 100644 index cfcc155cd6321607cb8445d6eea0162275d39290..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2601 zcmV+^3fA?BP)Px;<4Ht8RCodHn+>p4RTam1259+FRzzsPOAtoUNmG0&!%)enX{6&cWeHlQC8gQ) zLCiGjl$p(lmJaG*R8){(^DM>^Dlo>V8AlT-Oc2l;7KK=%g+P3~e*gRSdb94n_ndd$ zefL~0aMsNKt+m%)d+oi~*=wJD&bhB`zyV5KU0p{q^%KAlupT_y*4DNSUQiK%A_5ix z66IL19K^I0#R4$SYztmQfc5Zsw@^9=w+nI^<$7=xV+hJ%^R_mMsg9tVejAAmI4 zLFG*Fx;{DIi^du&SOtu>BP<4YgN5J)AR4h3hnY*)%xPkIW_|y2Q7!{&A*Y07h6~Fd z;-OKOe21Y@i=`8s8a3QZc`$fm&`Z7voB=)*bgj;G@$I;^6?p=?$x0hEb3X|A{pdEB zuHXkm1hf{6UNa$y$49cCVra>-8+j&pkVW*I9I&W#+xixmsxmYM-TBln>@K$SUmY!t ze#Dr2l0{0&dtghHG$Q*(4k&GUxEH5cokvShSH9m=0|o1Q8y?w z@P19#g-;z_dZ^Y|f)B+`zL(RcyouDZl_T^+U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