Menu

Ten years of Angular i18n in Swiss finance made me hate translation keys
📰

Ten years of Angular i18n in Swiss finance made me hate translation keys

DEV Community: typescript·Raphael·16 days ago
#x9zydA4E
#devtotypescript#devto#dev#every#keys
Reading 0:00
15s threshold

I've been building frontends for Swiss banks and financial software companies for over ten years. First AngularJS, then Angular, with some React in between. Switzerland has four national languages, so almost every one of these projects had to ship in German, French and English, and often Italian too.

So I've done a lot of Angular i18n. And I've come to a strong opinion: translation keys are built for the translation process, not for the developers who have to live with them.

Every project starts the same way

Someone sets up ngx-translate, creates en.json , and the templates start to look like this:

<h2> {{ 'PORTFOLIO.OVERVIEW.PERFORMANCE_TITLE' | translate }} </h2> <button> {{ 'COMMON.ACTIONS.SAVE' | translate }} </button>

Enter fullscreen mode

Exit fullscreen mode

It feels clean for about two sprints. Then:

Nobody knows whether PORTFOLIO.OVERVIEW.PERFORMANCE_TITLE is still used anywhere, so nobody dares to delete it.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.