Date post: | 16-Apr-2017 |
Category: |
Technology |
Upload: | yan-cui |
View: | 1,283 times |
Download: | 2 times |
Simplify Localization with Design Pattern Automation
an AOP success story by Yan Cui@theburningmonk
Hi, my name is Yan Cui@theburningmonk
plz ask question in the questions window
more text than first 3 Harry Porter books COMBINED!
localization needs to be applied in many, many places!
traditionally…
ingest gettext (.po) file
msgid = original text msgstr = localized text
ingest gettext (.po) file
substitute display text
button.text = getLocalizedText("back");
label.text = getLocalizedText("baits");
monster.name = getLocalizedText(monster.name);
...
ingest gettext (.po) file
substitute display text
render translated text instead
but wait…
but wait…what if we add another type of domain object or add/change
an screen?
ingest gettext (.po) file
substitute display text
render translated text instead
ingest gettext (.po) file
substitute display text
render translated text instead
hard to get good test coverage scope is too big
easy for regressions to creep in during frequent release cycles
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
THINK OUTSIDE
publisher service
our pipeline
publisher service
our pipeline
+
i’m a CMS
publisher service
our pipeline
validate pre-compute transform schema
yup, we iterate A LOT!
publisher service
our pipeline
flash/gamespec/298/… ios/gamespec/298/… server/gamespec/298/…
publisher service
our pipeline
chomp, chomp, chomp
chomp, chomp, chomp
chomp, chomp, chomp
publisher service
our pipeline
what if we localize here?
publisher service
our pipeline
so what goes here is already localized (where
necessary)
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/…
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!
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
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
ingest gettext (.po) file
substitute display text
render translated text instead
server team
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
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!
“thou shall not burn me” - a server dev
to ingest .po files in .Net
to automate implementation patterns in .Net
ps. we had a convention of suffix DTO types with VO
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
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
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
Q. how do I exclude a DTO from localization?
Q. how do I exclude a DTO from localization?
A. use [Localize(AttributeExclude = true)]
Q. where did the .po files come from?
Q. where did the .po files come from?
A. TNT
publisher service
+.PO
.PO
Q. where did the .po files come from?
A. TNT
publisher service
+.PO
.PO
Q. where did TNT get the .po files from?
A. you
publisher service
Q. where did TNT get the .po files from?
game designer
tool for generating new .po file
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
A. you
publisher service
Q. where did TNT get the .po files from?
game designer
tool for uploading .po file
@theburningmonktheburningmonk.comgithub.com/theburningmonk