le0c

i18n: in production

Prior to going to production, you should consider the following:

Bugs

One bug you might encounter is when interpolation fails:

<Invoice>
{translate('invoiceTitleAndNumber', {invoiceNumber: invoiceData.invoiceNumber })}</Invoice>

If your translation function does not handle this gracefully, you may end up with Invoice number: {{invoiceNumber}} appearing in your application.

Another stepping stone to consider is the strategy by which you deliver your dictionary to your application. You may wish to grab a copy via your CI/CD scripts when the application is being built & bundle that. You may wish to serve this programmatically via API. In both cases, you might have to adapt how your translation function works to accommodate for this. In our use case, bundling the latest copy of the dictionary with the application when it was built was the right call.

You should also consider how your translation function behaves when it receives a token which:

Additionally, you can catch errors like this by engineering your CI/CD scripts:

next: doing it again