Message extraction #456
Replies: 4 comments 10 replies
-
why is this not a priority, large projects need this |
Beta Was this translation helpful? Give feedback.
-
👋 The structure of messages in our project looks like this: .
└── messages/
├── cs/
│ ├── blog.json
│ └── common.json
├── en/
│ ├── blog.json
│ └── common.json
└── de/
├── blog.json
└── common.json So feel free to adjust it to your use-case. |
Beta Was this translation helpful? Give feedback.
-
@felix-quotez just shared his message extraction strategy in #1700 (comment): import { defineMessages } from '@tw/intl/define-messages'
import { useTranslations } from '@tw/intl/use-translations'
defineMessages({
propertyNameIsIgnoredInFavorOfIdBelow: {
id: 'a.b',
description: 'foo',
defaultMessage: 'bar',
},
})
export function Component() {
const t = useTranslations('a')
return t('b')
}
|
Beta Was this translation helpful? Give feedback.
-
An argument that @remcohaszing has just brought up for message extraction: It helps to purge unused messages automatically. Another thought I had recently is that maybe defining messages inline could be helpful in regard to AI generation of code, similar to how TailwindCSS works really well with these tools. But AI tools are also improving and multi file editing is already a possibility, so not sure if this will be a benefit in the long run. One aspect surely is though that defining messages inline is a bit more friendly for quick prototyping. I haven't made my mind up yet on this subject, for the time being I'm happy to discuss experiences that people have made and to explore the pro's and con's of this approach—also potentially community-based solutions. |
Beta Was this translation helpful? Give feedback.
-
Hello,
what's the recommended approach to extract messages from the source code and generate the JSON automatically?
Thank you.
Beta Was this translation helpful? Give feedback.
All reactions