How do you test your app for Iñtërnâtiônàlizætiøn? (Internationalization?)

后端 未结 6 886
自闭症患者
自闭症患者 2020-12-24 08:31

How do you test your app for Iñtërnâtiônàlizætiøn compliance? I tell people to store the Unicode string Iñtërnâtiônàlizætiøn into each field and then see if it is displayed

相关标签:
6条回答
  • 2020-12-24 09:11

    "Iñtërnâtiônàlizætiøn" is a really bad string to test with since all the characters in it also appear in ISO-8859-1, so the string can work completely without any Unicode support at all! I've no idea why it's so commonly used when it utterly fails at its primary function!

    Even Chinese or Hebrew text isn't a good choice (though right-to-left is a whole can of worms by itself) because it doesn't necessarily contain anything outside 3-byte UTF-8, which curiously was a very large hole in MySQL's default UTF-8 implementation (which is limited to 3-byte chars), until it was fixed by the addition of the utf8mb4 charset in MySQL 5.5. These days one of the more common uses of >3-byte UTF-8 is Emojis like these: [

    0 讨论(0)
  • 2020-12-24 09:12

    First, learn The Absolute Minimum Every Software Developer Absolutely, Positively Must Know About Unicode and Character Sets.

    Make sure your application can handle Turkish. It has several quirks that break applications that assume English rules. Because there are four kinds of letter "i" (dotted and dot-less, upper and lower case), applications that assume uppercase(i) => I will break when using Turkish rules, where uppercase(i) => İ.

    A common thing to do is check if the user typed the command "exit" by using lowercase(userInput) == "exit" or uppercase(userInput) == "EXIT". This works as expected under English rules but will fail under Turkish rules where "exıt" != "exit" and "EXİT" != "EXIT". To do this correctly, one must use case-insensitive comparison routines which are built into all modern languages.

    0 讨论(0)
  • 2020-12-24 09:18

    Use one of the three "pseudo-locales" available since Windows Vista:

    The three different pseudo-locale are for testing 3 kinds of locales:

    Base The qps-ploc locale is used for English-like pseudo localizations. Its strings are longer versions of English strings, using non-Latin and accented characters instead of the normal script. Additionally simple Latin strings should sort in reverse order with this locale.

    Mirrored qpa-mirr is used for right-to-left pseudo data, which is another area of interest for testing.

    East Asian qps-asia is intended to utilize the large CJK character repertoire, which is also useful for testing.

    Windows will start formatting dates, times, numbers, currencies in a made-up psuedo-locale that looks enough like english that you can work with it, but obvious enough when you're not respecting the locale:

    [Шěđлеśđαỳ !!!], 8 ōf [Μäŕςћ !!] ōf 2006

    0 讨论(0)
  • 2020-12-24 09:18

    I was thinking about this question from a completely different angle. I can't recall exactly what we did, but on a previous project I think we wound up changing the Regional Settings (in the Regional and Language Options control panel?) to help us ensure the localized strings were working.

    0 讨论(0)
  • 2020-12-24 09:22

    Pick a culture where the text reads from right to left and set your system up for that - make sure that it reads properly (easier said than done...).

    0 讨论(0)
  • 2020-12-24 09:31

    There is more to internationalization than unicode handling. You also need to make sure that dates show up localized to the user's timezone, if you know it (and make sure there's a way for people to tell you what their time zone is).

    One handy fact for testing timezone handling is that there are two timezones (Pacific/Tongatapu and Pacific/Midway) that are actually 24 hours apart. So if timezones are being handled properly, the dates should never be the same for users in those two timezones for any timestamp. If you use any other timezones in your tests, results may vary depending on the time of day you run your test suite.

    You also need to make sure dates and times are formatted in a way that makes sense for the user's locale, or failing that, that any potential ambiguity in the rendering of dates is explained (e.g. "05/11/2009 (dd/mm/yyyy)").

    0 讨论(0)
提交回复
热议问题