simplify localization with design pattern automation

79
Simplify Localization with Design Pattern Automation an AOP success story by Yan Cui @theburningmonk

Upload: yan-cui

Post on 16-Apr-2017

1.283 views

Category:

Technology


2 download

TRANSCRIPT

Page 1: Simplify Localization with Design Pattern Automation

Simplify Localization with Design Pattern Automation

an AOP success story by Yan Cui@theburningmonk

Page 2: Simplify Localization with Design Pattern Automation

Hi, my name is Yan Cui@theburningmonk

Page 3: Simplify Localization with Design Pattern Automation

plz ask question in the questions window

Page 4: Simplify Localization with Design Pattern Automation
Page 5: Simplify Localization with Design Pattern Automation
Page 6: Simplify Localization with Design Pattern Automation
Page 7: Simplify Localization with Design Pattern Automation
Page 8: Simplify Localization with Design Pattern Automation

more text than first 3 Harry Porter books COMBINED!

Page 9: Simplify Localization with Design Pattern Automation
Page 10: Simplify Localization with Design Pattern Automation
Page 11: Simplify Localization with Design Pattern Automation
Page 12: Simplify Localization with Design Pattern Automation

localization needs to be applied in many, many places!

Page 13: Simplify Localization with Design Pattern Automation

http://engt.co/2eQav4x

Page 14: Simplify Localization with Design Pattern Automation

http://engt.co/2eQav4x

Page 15: Simplify Localization with Design Pattern Automation

traditionally…

Page 16: Simplify Localization with Design Pattern Automation

ingest gettext (.po) file

Page 17: Simplify Localization with Design Pattern Automation
Page 18: Simplify Localization with Design Pattern Automation

msgid = original text msgstr = localized text

Page 19: Simplify Localization with Design Pattern Automation

ingest gettext (.po) file

substitute display text

Page 20: Simplify Localization with Design Pattern Automation

button.text = getLocalizedText("back");

label.text = getLocalizedText("baits");

monster.name = getLocalizedText(monster.name);

...

Page 21: Simplify Localization with Design Pattern Automation

ingest gettext (.po) file

substitute display text

render translated text instead

Page 22: Simplify Localization with Design Pattern Automation
Page 23: Simplify Localization with Design Pattern Automation
Page 24: Simplify Localization with Design Pattern Automation

but wait…

Page 25: Simplify Localization with Design Pattern Automation

but wait…what if we add another type of domain object or add/change

an screen?

Page 26: Simplify Localization with Design Pattern Automation

ingest gettext (.po) file

substitute display text

render translated text instead

Page 27: Simplify Localization with Design Pattern Automation

ingest gettext (.po) file

substitute display text

render translated text instead

Page 28: Simplify Localization with Design Pattern Automation

http://engt.co/2eQav4x

Page 29: Simplify Localization with Design Pattern Automation

hard to get good test coverage scope is too big

Page 30: Simplify Localization with Design Pattern Automation

easy for regressions to creep in during frequent release cycles

Page 31: Simplify Localization with Design Pattern Automation

6 sins of traditional approach to localization

large up-front development effortnot future proof

duplicated effort for each client platformhard to get good test coverage

prone to regressionspressure on QA resources

Page 32: Simplify Localization with Design Pattern Automation
Page 33: Simplify Localization with Design Pattern Automation

THINK OUTSIDE

Page 34: Simplify Localization with Design Pattern Automation

publisher service

our pipeline

Page 35: Simplify Localization with Design Pattern Automation

publisher service

our pipeline

+

i’m a CMS

Page 36: Simplify Localization with Design Pattern Automation
Page 37: Simplify Localization with Design Pattern Automation
Page 38: Simplify Localization with Design Pattern Automation

publisher service

our pipeline

validate pre-compute transform schema

Page 39: Simplify Localization with Design Pattern Automation
Page 40: Simplify Localization with Design Pattern Automation

yup, we iterate A LOT!

Page 41: Simplify Localization with Design Pattern Automation

publisher service

our pipeline

flash/gamespec/298/… ios/gamespec/298/… server/gamespec/298/…

Page 42: Simplify Localization with Design Pattern Automation
Page 43: Simplify Localization with Design Pattern Automation

http://bit.ly/2fwvkmS

Page 44: Simplify Localization with Design Pattern Automation

publisher service

our pipeline

chomp, chomp, chomp

chomp, chomp, chomp

chomp, chomp, chomp

Page 45: Simplify Localization with Design Pattern Automation

publisher service

our pipeline

what if we localize here?

Page 46: Simplify Localization with Design Pattern Automation

publisher service

our pipeline

so what goes here is already localized (where

necessary)

Page 47: Simplify Localization with Design Pattern Automation

publisher service

our pipeline

flash/gamespec/en_GB/298/… flash/gamespec/pt_BR/298/… ios/gamespec/en_GB/298/… ios/gamespec/pt_BR/298/… server/gamespec/298/…

Page 48: Simplify Localization with Design Pattern Automation

publisher service

our pipeline

flash/gamespec/en_GB/298/… flash/gamespec/pt_BR/298/… ios/gamespec/en_GB/298/… ios/gamespec/pt_BR/298/… server/gamespec/298/…

don’t localize my stuff!

Page 49: Simplify Localization with Design Pattern Automation

6 sins of traditional approach to localization

large up-front development effortnot future proof

duplicated effort for each client platformhard to get good test coverage

prone to regressionspressure on QA resources

Page 50: Simplify Localization with Design Pattern Automation

6 sins of traditional approach to localization

large up-front development effortnot future proof

duplicated effort for each client platformhard to get good test coverage

prone to regressionspressure on QA resources

Page 51: Simplify Localization with Design Pattern Automation

ingest gettext (.po) file

substitute display text

render translated text instead

Page 52: Simplify Localization with Design Pattern Automation

server team

Page 53: Simplify Localization with Design Pattern Automation

1. ingest gettext (.po) file

2. check domain objects for string fields/properties

3. use localized text when transforming to DTO

4. repeat for next language

Page 54: Simplify Localization with Design Pattern Automation

1. ingest gettext (.po) file

2. check domain objects for string fields/properties

3. use localized text when transforming to DTO

4. repeat for next language

hey Watson! I found a Pattern!

Page 55: Simplify Localization with Design Pattern Automation

“thou shall not burn me” - a server dev

Page 56: Simplify Localization with Design Pattern Automation

to ingest .po files in .Net

Page 57: Simplify Localization with Design Pattern Automation

to automate implementation patterns in .Net

Page 58: Simplify Localization with Design Pattern Automation
Page 59: Simplify Localization with Design Pattern Automation
Page 60: Simplify Localization with Design Pattern Automation
Page 61: Simplify Localization with Design Pattern Automation
Page 62: Simplify Localization with Design Pattern Automation
Page 63: Simplify Localization with Design Pattern Automation

ps. we had a convention of suffix DTO types with VO

Page 64: Simplify Localization with Design Pattern Automation

6 sins of traditional approach to localization

large up-front development effortnot future proof

duplicated effort for each client platformhard to get good test coverage

prone to regressionspressure on QA resources

Page 65: Simplify Localization with Design Pattern Automation

6 sins of traditional approach to localization

large up-front development effortnot future proof

duplicated effort for each client platformhard to get good test coverage

prone to regressionspressure on QA resources

Page 66: Simplify Localization with Design Pattern Automation

6 sins of traditional approach to localization

large up-front development effortnot future proof

duplicated effort for each client platformhard to get good test coverage

prone to regressionspressure on QA resources

Page 67: Simplify Localization with Design Pattern Automation

Q. how do I exclude a DTO from localization?

Page 68: Simplify Localization with Design Pattern Automation

Q. how do I exclude a DTO from localization?

A. use [Localize(AttributeExclude = true)]

Page 69: Simplify Localization with Design Pattern Automation

Q. where did the .po files come from?

Page 70: Simplify Localization with Design Pattern Automation

Q. where did the .po files come from?

A. TNT

publisher service

+.PO

.PO

Page 71: Simplify Localization with Design Pattern Automation

Q. where did the .po files come from?

A. TNT

publisher service

+.PO

.PO

Page 72: Simplify Localization with Design Pattern Automation

Q. where did TNT get the .po files from?

Page 73: Simplify Localization with Design Pattern Automation

A. you

publisher service

Q. where did TNT get the .po files from?

game designer

tool for generating new .po file

Page 74: Simplify Localization with Design Pattern Automation
Page 75: Simplify Localization with Design Pattern Automation
Page 76: Simplify Localization with Design Pattern Automation

A. you

publisher service

Q. where did TNT get the .po files from?

game designer

tool for generating new .po fileunchanged strings keep msgstrchanged strings has empty msgstr

Page 77: Simplify Localization with Design Pattern Automation

A. you

publisher service

Q. where did TNT get the .po files from?

game designer

tool for uploading .po file

Page 78: Simplify Localization with Design Pattern Automation
Page 79: Simplify Localization with Design Pattern Automation

@theburningmonktheburningmonk.comgithub.com/theburningmonk