-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore: Add localization file #27
Conversation
getAdditionsText: (count) => | ||
i18n.tp("diffs_additionsText", count, [String(count)]), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Annoying that I have to wrap the number in a string here for the substitution array.
@@ -14,7 +16,7 @@ const emits = defineEmits<{ | |||
|
|||
<textarea | |||
class="font-mono p-2 w-full resize-y m-0 outline-none -mb-1 min-h-[5rem]" | |||
:placeholder="'Enter glob patterns:\n*.lock\n**/vendor/**'" | |||
:placeholder="t('options_customLists_customRepoPlaceholder')" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using underscores make it hard to select individual parts of the key. Double clicking the string selects everything.
But I want to avoid anything at runtime like .replaceAll('.', '_')
that could slow things down. So I don't think this is easily solved.
customRepoPlaceholder: | | ||
Enter glob patterns: | ||
*.lock | ||
**/vendor/** |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This works! Easily add newlines to strings.
@@ -20,6 +20,7 @@ export default defineConfig({ | |||
manifest: ({ browser }) => { | |||
const manifest: UserManifest = { | |||
permissions: ["storage"], | |||
default_locale: "en", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remember to add this, otherwise types for i18n.t
/i18n.tp
won't be generated.
getDeletionsText: (count) => `${count} deletions`, | ||
getGeneratedText: (count) => `${count} generated lines.`, | ||
getAdditionsText: (count) => | ||
i18n.tp("diffs_additionsText", count, [String(count)]), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't like that there's a separate function for plurals. I'd rather just use an override for t
with 3 arguments.
Close in favor of #37 |
Example localization for wxt-dev/wxt#343