Localization and internationalization, what's the difference?

前端 未结 15 1821
执笔经年
执笔经年 2020-12-04 05:33

I was going to ask a question about preparing a desktop application to support multiple languages on the UI.

In my search for existing questions on the topic I was

15条回答
  •  北海茫月
    2020-12-04 05:47

    Lot of answers, lot of correct information, but my answer is little bit another point of view.

    Internationalization - it is when developer does not have in code direct messages/error messages/buttons names/labels captions/etc in certain language but have a key which is passed to translation function, and translation function according to current user's locale will return final text in english/france/etc...
    Translation function works with storage (db/files/associative array/etc).
    Storage contains keys which is ussed in coode, and values, which is texts in certain language which application supports.

    Localization - it is process of adding new values in new language (for example spain) appropriate to keys into storage without involving developer in this process.

    For example, we have storage:

    key   | english    | italian           |
    ------+------------+-------------------+
    title | Welcome    | Benvenuto         |
    agree | I agree    | Sono d'accordo    |
    thank | Thank you  | Grazie            |
    

    Internationalization it is using in code something like confirm(t(agree)); instead of confirm("I agree"); or confirm("Sono d'accordo");
    Localization - it is add new locale to our storage, like:

    key   | english    | italian           | spanish          |
    ------+------------+-------------------+------------------+
    title | Welcome    | Benvenuto         | Bienvenido       |
    agree | I agree    | Sono d'accordo    | Estoy de acuerdo |
    thank | Thank you  | Grazie            | Gracias          |
    

    and here developer don't need update code, translation function will correctly carry appropriate texts.

提交回复
热议问题