#CATI Initiative: Composition API, TypeScript, Internationalization

1 messages · Page 1 of 1 (latest)

rare vale
remote oak
#

cat_happyi

rare vale
#

yeah, CAT was on purpose 🐈‍⬛

#

@lunar pewter @queen finch COME ERE COMEHERE

ruby tapir
#

Is there any way to use omorphia now without having to setup an i18n instance, which is essentially impossible as these instances are directly configured for knossos/theseus

#

I know allowing non-modrinth projects to keep working isn't the essential goal, but there has to be a minute change that could be made so that it doesn't kill external projects that use omorphia?

rare vale
#

is there something preventing you from adding vintl to your project?

ruby tapir
#

It's not related to not adding vintl, but implementing it

ruby tapir
#

Vintl is overkill for small projects - majority of projects i've developed with omorphia either dont use translations at all, or use either vue-i18n or nuxt-i18n

#

but yeah

#

if there's a simple way to translate between nuxt/vue-i18n to vintl lmk

queen finch
rare vale
#

it basically creates a subtype of string, and that prevents widening. when typescript evaluates a type, if it sees you use string alongside string literals, it will just widen to type to string, because it makes no sense to have those literals. so this subtype trick avoids this optimisation, while inheriting all the benefits of having literals and string combined — typescript would give you suggestion to use any of the literals, but you can always use a string which will successfully extend this subtype with nothing required from you

wild oxide
#

and in your fork you could remove things like i18n that you may not use

ruby tapir
#

Fair enough

rare vale
rare vale
lunar pewter
queen finch
#

will do 👍

lunar pewter
#

@remote oak @normal yarrow Now that most of the new features have been merged, can we resume the i18n project or is it better to wait for the merge of the redesign ?

normal yarrow
#

yes! redesign probs won't be merged for a while

lunar pewter
rare vale
#

I'll only be able to review this on wednesday

rare vale
#

don't think I'll be able to review any of PRs today since github is throwing a tantrum

lunar pewter
#

It's merged

lunar pewter
rare vale
#

I think we need to re-organise common messages file

lunar pewter
#

Like having multiple variables for messages ?

rare vale
#

prolly some kind of nested struct

lunar pewter
#

Like what ?

rare vale
#

we can use the auto-wrapping feature of unimport and basically define like

// utils/common-messages.ts
const pageTitles = defineMessages({})
const actions = defineMessages({})
export default { pageTitles, actions }

which will give us like commonMessages.actions.delete, etc.

#

of course I'm not a heavy fan even of that, feels wrong to define page titles outside the page component

lunar pewter
#

Yeah, but, in the case (for example) of collections, we have the same string (Collections) in three components (dashboard navstack, collections and default layout)

#

But I'm okay with the fact that we need to rework common messages.

#

And btw, I was wondering, for pages that have modals, wouldn't it be interesting to separate the keys from the modals and the rest into several variables?

rare vale
#

I think we might define message exports like that right in the page components files, this way we can ensure the messages are still collocated with the component

#
<script lang="ts">
export const messages = defineMessages({ /* ... */ })
</script>
<script setup lang="ts">
const { formatMessage } = useVIntl()
useHead({
  title: () => formatMessage(messages.title),
})
</script>
#

the problem with this though is that it creates mixed exports which are very yucky

#

but since we build ESM in well-defined vite configuration it should be ooookay

#

I'm also a bit worried that it might not allow to use messages in template itself

#

which it should, but iirc it didn't work with like volar

#

nvm it totally works!

rare vale
#

vite doesn't even try to split messages to its own chunk despite it being used in two separate modules

#

the result is that the whole component module is imported

lunar pewter
#

So, what do we do? We leave it like this for the moment or we change the structure ?

normal yarrow
#

would merge but since it's a kinda unique use case wanted to run it by u

rare vale
#

as far as localisation is concerned, I think that works, although I really don't think formatting messages should be scopes' concern, and as for overall implementation, I think it can be better too. feel free to merge for now, and I might come up with a different implementation later

rare vale
rare vale
rare vale
rare vale
#

1111 hhh

lunar pewter
#

Yeah... It's been like this for 2, 3 days almost.

lunar pewter
#

@rare vale For normalization (your PR), how can we transform this key ?

rare vale
#

It's already good

lunar pewter
#

👍

rare vale
#

brawaru for knossos

#

brb turning myself into a nuxt module

#

probably worth adding BROWSER_BASE_URL=https://api.modrinth.com/v2/ to preview deployments env at this point lol

lunar pewter
#

@rare vale

I merged all your PRs ^^.

lunar pewter
tender robin
rare vale
#
error: cannot lock ref 'refs/remotes/mysterious/twitter->x': Unable to create 'U:/modrinth-omorphia/.git/refs/remotes/mysterious/twitter->x.lock': Invalid argument
 ! [new branch]      twitter->x            -> mysterious/twitter->x  (unable to update local ref)

imagine using illegal characters in your ref names

#

didn't you get it merged already

lunar pewter
#

@rare vale For "authorize" PR, how you think I can normalize this key ?

#

I only have one error for this page, should I put it in a new message variable?

rare vale
#

auth.authorize.error.no-redirect-url probably?

#

that's oauth right?

lunar pewter
#

Yes

rare vale
#

I need to check where its used, I think it refers to redirect URI which should be sent along with all oauth requests

rare vale
#

this string in particular doesn't have anything to do with redirect URI, it is just shown when the response from accept oauth endpoint doesn't have a string telling where to redirect the user :P

rare vale
#

@lunar pewter pros went on a merging spree so I think some of yours PRs are in conflict with main now

wild oxide
#

yea these big files are being kinda annoying

#

every time I merge one there's a merge conflict

rare vale
#

I thought and we maybe can get rid of auto-generated en-US messages file if we use custom workflow for crowdin

wild oxide
#

yeah

#

how can I regenerate the json?

#

I wanna do it to make sure the order is good and nothing got fucked in the great mergening

rare vale
#

pnpm intl:extract

wild oxide
#

ty

#

the other great thing is staging is down so builds never pass lol

#

so I gotta test locally

wild oxide
#

@rare vale should master be pulled into i18n/master ?

#

or does it base translation keys off of the actual master branch

rare vale
wild oxide
#

hmm ok

#

gonna create a backup of it just in case

#

are we able to force a sync

remote oak
#

in the crowdin dashboard yes

wild oxide
#

I don't think I have access to that but are you possibly able to?

remote oak
#

yeah, I can, but you do have access, the modrinth account credentials are in notion

wild oxide
#

ah ok

remote oak
#

syncing now

wild oxide
#

shall we merge the big translation PR?

remote oak
#

I think we should wait until we actually enable some translations

wild oxide
#

gonna play with some of them locally and see how much of the site is actually translated

remote oak
#

I don't know if we should enable it with like a banner at the top of the language selection screen saying something along the lines of "only some pages are translated" or if we should wait until it's mostly done

#

afaik it's not much at all

rare vale
#

mysterious made issues with progress

wild oxide
#

I think it would be fine to start enabling languages that have full translations for the main user-facing pages

#

still a bit of a ways from that

#

but getting there

#

lool it's funny how like 1 of the settings pages has a chinese translation

rare vale
#

I prolly should join mysterious on his quest to make every single thing translatable

wild oxide
#

one thing I'm not 100% sure about is using formatMessage in the navRoutes ref, I dunno if it will cause reactivity issues or something?

rare vale
#

hey @wild oxide maybe you can pull fixup/pr/1616/2 from my remote (https://github.com/brawaru/modrinth-knossos.git) manually to not create another PR?

wild oxide
#

how does the SEO translation stuff work

rare vale
#

it's a computed value

wild oxide
#

also pushed

#

but the SEO would never be set to another language right?

#

or is there a way to set a language for it?

rare vale
#

I do kinda want to add routing strategy to nuxt vintl in the future, to have localised routes (except default), like https://modrinth.com/de/mod/sodium, instead of the parameter. haven't to actually code it, but have some ideas how it might be implemented

wild oxide
#

yeah sure!

lunar pewter
#

Okay, nice 👍

rare vale
#

anxious thoughts about a custom actions workflows for syncing translations that we may loose the translation files again if we disconnect the github integration

#

okay disconnecting the integrating doesn't seem to yeet the files from crowdin

lunar pewter
wild oxide
#

think someone just forgot to remove it when it was no longer used

lunar pewter
#

Yeah so I'm deleting it from my PR

wild oxide
#

btw, don't touch settings pages, I am redoing them effectively

lunar pewter
#

For what, omorphia or translations ?

wild oxide
#

in general

#

anything you touch on them would probably get nuked

lunar pewter
#

All right ^^.

rare vale
#

I think I'm going to refactor creation modal modal after 1625 is merged

wild oxide
#

I was actually thinking it might be good to make the creation thing a page instead of a modal

#

and give it a couple extra options like adding it to an org right off the bat and stuff

#

but idk

normal yarrow
wild oxide
#

sorta but not if you create it from the main "create a project" button

rare vale
#

guided project creation page can be cool

#

like four steps

  • information about project
  • additional information (description, tags?)
  • uploading the first version
  • submit for review
  • ‘congrats! your project is being reviewed. check how it looks!’
#

similar to when you set up discord onboarding for the first time

#

and of course for those who prefer the old approach of immediately getting to the page just have ‘Not now’ option

queen finch
#

quick questions whats the current state of this?

as far as i know this was postponed because of a redesign. But this redesign got scrapped right?

so does it make sense to get the omorphia PR's uptodate?

rare vale
#

and then I can just add option to replace defineMessage and defineMessages with macros that automatically clean descriptors of things like comments and transform/remove default messages, which will help in the future to reduce the bundle size as more and more parts getting translated

rare vale
#

................ I think formatJS have patched out the type coercion for variables

#

rip compact-number hack

#

or not? huuuuuuuh