Next.js Discord

Discord Forum

How do I assign lang & dir attributes for <html /> outside root layout

Unanswered
Japanese cockle posted this in #help-forum
Open in Discord
Japanese cockleOP
Current implementation of i18n in my app uses root layout defined under a dynamic route [lang] as in src/app/[lang]/layout.tsx. This way I can use html element in the intended way. However there's a problem related to the usage of not-found convention in this case.

To use not-found file I have to place it in the root of app directory (otherwise it won't work). That being said it is missing the root layout because it is defined under dynamic route.

Defining html element in src/app/layout.tsx is not a thing for me because the layout I use right now adds a lang/dir attribute based on dynamic param.

At this point I wonder if I can assign these attributes outside the root layout?

1 Reply

Japanese cockleOP
To clarify, I use [this](https://locize.com/blog/next-app-dir-i18n/) i18n template due to the fact that next-translate simply doesn't work ¯\_(ツ)_/¯