Best Practices for writing software to be consumed internationally (i18n)

前端 未结 6 1469
既然无缘
既然无缘 2020-12-28 09:19

I am looking for opinions from experts that have written software consumed internationally. I would like to understand the best practices people have employeed at each logic

6条回答
  •  礼貌的吻别
    2020-12-28 09:52

    Data

    • When you go to UTF-8, be prepared for characters to take up to 3 bytes each (in the case of Chinese), which means that VARCHAR(20) now needs to be a VARCHAR(60).
    • Unless you really have a good reason to do it, for the love of god, don't store your UI translations in the DB.

    Business

    • Spend a lot of time on requirements. As a starting point, take a screenshot of every single screen in your app, put it in a document, and start drawing boxes around things that need i18n support. Then map each of those boxes to an area of code that needs to change.

    UI

    Don’t

    string foo = "Page " + currentPage + " of " + totalPages;
    

    Do

    string foo = string.Format("Page {0} of {1}", currentPage, totalPages);
    

    Why? Word Order Matters.

    Page {0} of {1}
     {1}ページ中の第{0}ページ
    

    Nothing is sacred in the UI Even something as fundamental as showing green for positive numbers and red for negative numbers is fair game.

提交回复
热议问题