Skip to main content
Version: 2.x

Caching Strategy

The library keeps a map of originalPath → translatedPath so that browser Back/Forward navigation and language changes can restore the correct Angular route.

localStorage (default)

provideNgxTranslateRoutes({
cacheMethod: 'localStorage',
})

Data persists across tabs and browser sessions.

Cookies

provideNgxTranslateRoutes({
cacheMethod: 'cookies',
cookieExpirationDays: 7, // default: 30
})

Useful when you need the storage to expire or when localStorage is unavailable (e.g. Safari ITP restrictions).

SSR

On the server side the library uses Angular TransferState regardless of cacheMethod, so the translated path is available immediately after hydration.