Skip to content
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

add experimental variant support to inlang message format plugin #221

Closed
3 tasks done
samuelstroschein opened this issue Sep 12, 2024 — with Linear · 2 comments
Closed
3 tasks done

add experimental variant support to inlang message format plugin #221

samuelstroschein opened this issue Sep 12, 2024 — with Linear · 2 comments
Assignees
Labels

Comments

Copy link
Member

samuelstroschein commented Sep 12, 2024

Context

The inlang message format needs variant support to prerelease paraglide js. Loris implemented something. I need to verify that everything works as expected.

  • remove @inlang/sdk 1 from dependencies for v2
    • update tests
  • update vitest

Observations

  • bundle alias is not used (indicates that it's not plugin related and should be unbundled into own entity MESDK-239)
				alias: {},
export const importFiles: NonNullable<(typeof plugin)["importFiles"]> = async ({ files }) => {
	const messages = files.flatMap(parseFile)
	const bundlesIndex: Record<string, any> = {}

	for (const message of messages) {
		if (bundlesIndex[message.bundleId] === undefined) {
			bundlesIndex[message.bundleId] = {
				id: message.bundleId,
				alias: {},
				messages: [message],
			}
		} else {
			bundlesIndex[message.bundleId].messages.push(message)
		}
	}

	const bundles = Object.values(bundlesIndex) as NewBundleNested[]

	return { bundles }
}
  • what about exposing db? complexity stems from transforming the entities as the plugins needs it like groupBy or selectNested. that comes out of the box with kysely

	const messages = bundles.flatMap((bundle) => bundle.messages)
  • nodeFs is not used in toBeImportedFiles removing it would remove all fs related things from plugins 🥳
  • matching undefined is desirable
"username=*":
	"{username} has to download the app.",
"username=undefined": 
    "The person has to download the app.",
  • renaming variant matchers leads to unstable ids aka duplicate variants. solving this seems out of proportion given that the lix host is around the corner.
Copy link
Member Author

It seems like paraglide provided an icu1 plugin to test variants. the inlang message format does not contain information for variant support yet. i will add variant support to the inlang message format, then release paraglide js

@samuelstroschein samuelstroschein changed the title verify inlang message format variant support ad Sep 12, 2024
@samuelstroschein samuelstroschein changed the title ad add experimental variant support to inlang message format plugin Sep 12, 2024
@samuelstroschein samuelstroschein added the v2.0 label Sep 12, 2024 — with Linear
Copy link
Member Author

While building the plugin numerous discrepancies in the data structure emerged. See MESDK-237. The result is MESDK-238

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant