Is there any way to use useLocalizedStringFormatter
without @internationlized/string-compiler
?
#6463
Unanswered
tuananhlai
asked this question in
Q&A
Replies: 1 comment
-
👋 If you simply want to use If you want to use formatting options following the These files follow the ICU Message Format standard, you must include the Heres a sample of code that i use for this: import { compileStrings } from "@internationalized/string-compiler";
import { readFile } from "fs/promises";
export function createIntlEsbuildPlugin() {
return {
name: "intl-plugin",
setup(build) {
build.onLoad({ filter: /(intl).*\.json$/ }, async args => {
const content = await readFile(args.path, "utf8");
const json = JSON.parse(content);
const code = compileStrings(json);
return { contents: code };
});
}
};
} and then in my tsup config: esbuildPlugins: [
createIntlEsbuildPlugin()
] |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi 👋
I'm trying to use
useLocalizedStringFormatter
with custom messages for my design system library. It seems like I need to use@internationlized/string-compiler
with my bundler for that hook to work properly. Since I'm unsure how to getstring-compiler
to work with my bundler (tsup
), is it possible to useuseLocalizedStringFormatter
without it?Thank you in advance for your help.
Beta Was this translation helpful? Give feedback.
All reactions