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

Project: Paraglide JS 2.0 (variants, pluralization, gendering) #201

Open
2 tasks done
samuelstroschein opened this issue Sep 3, 2024 — with Linear · 52 comments · Fixed by opral/monorepo#3342
Open
2 tasks done

Project: Paraglide JS 2.0 (variants, pluralization, gendering) #201

samuelstroschein opened this issue Sep 3, 2024 — with Linear · 52 comments · Fixed by opral/monorepo#3342
Assignees
Labels

Comments

Copy link
Member

samuelstroschein commented Sep 3, 2024

Context

This issue serves as "subscribe here to stay up to date with paraglide js 2.0".

Changelog

Tasks/issues

See issues with the "v2.0" label

@juliomuhlbauer
Copy link

juliomuhlbauer commented Sep 5, 2024

This could be fixed: #146 (it is really annoying)

@samuelstroschein samuelstroschein changed the title Paraglide JS 2.0 project (variants, pluralization, gendering) Project: Paraglide JS 2.0 (variants, pluralization, gendering) Sep 6, 2024
@samuelstroschein samuelstroschein pinned this issue Sep 6, 2024
@samuelstroschein
Copy link
Member Author

@juliomuhlbauer added to the project that comes after paraglide js 2.0 (metaframework overhaul) #217

Copy link
Member Author

Progress is halted until the message format plugin, which most paraglide users use, is updated to v3 #221. While updating the message format to v3, the data model showed inconsistencies, see opral/inlang-sdk#195.

Number 1 prio is to resolve the data model problems. Work on paralglide 2.0 will continue afterward

@samuelstroschein
Copy link
Member Author

From discord https://discord.com/channels/897438559458430986/1094614450004303993/1286100529210064960

End to end import, CRUD, export achieved

Milestone achieved. We are now entering the phase of taking the observations from an end to end workflow to fix bugs and do adjustemnts where useful/required

Uploading CleanShot 2024-09-18 at 19.00.29.mp4…

Copy link
Member Author

Work on paraglide 2.0 continues. Might have a pre-release by the end of the day!

  • the inlang sdk v2 is stable
  • the message format plugin supports variants (!)

Copy link
Member Author

samuelstroschein commented Sep 27, 2024

Logical tests are passing. TypeSafety is still a todo. Hence, no pre-release today and no prerelease until October 7. We are having an onsite next week in Rome which a) I have to attend and b) I have to prep for tmr :)

CleanShot 2024-09-26 at 21.04.15@2x.png

@samuelstroschein
Copy link
Member Author

Update:

The tests are passing now, but a release of Paraglide JS 2.0 is postponed until we have lix 1.0, which powers Paraglide JS. That's likely in January or February.

Shifting.the.primary.focus.from.Inlang.to.Lix.mp4

@nosovk

This comment has been minimized.

@samuelstroschein
Copy link
Member Author

What's this? 👀 Hint: Work continues. Paraglide JS 2.0 beta this January

CleanShot 2025-01-03 at 14 11 15@2x

@samuelstroschein
Copy link
Member Author

Paraglide JS 2.0 Beta has been released

  • variant (plural, gendering, a/b test) support 🥳
  • test the beta and report issues
  • targeting general availability by the end of January

Here are examples to get started https://github.com/opral/monorepo/tree/main/inlang/packages/paraglide-js/examples

Paraglide.js.2.0.Beta.Overview.-converted.mp4

@nykula

This comment has been minimized.

@samuelstroschein

This comment has been minimized.

@gooonzick

This comment has been minimized.

@samuelstroschein

This comment has been minimized.

This comment has been minimized.

@samuelstroschein
Copy link
Member Author

samuelstroschein commented Jan 16, 2025

Question about the API. Should Paraglide JS 2.0

👀 prefix locale suff with "Available"

import { availableLocales, type AvailableLocale, assertAvailableLocale } from "./paraglide/runtime.js"

const locale: AvailableLocale = "en"

if (availableLocales.includes("de")){
  //
}

const x = assertAvailableLocale("fr")

🚀 or drop the available prefix

import { locales, type Locale, assertLocale } from "./paraglide/runtime.js"

const locale: Locale = "en"

if (locales.includes("de")){
  //
}

const x = assertLocale("fr")

Vote with 👀 for available prefix or 🚀 for no prefix

@samuelstroschein
Copy link
Member Author

Gonna go with a bundled version of path-to-regex for #359.

I won't work tomorrow and Thursday on Paraglide 2.0 as I am attending a conference. A release candidate at the end of the week is thereby unlikely but a new beta with the pathname API on Friday is likely.

Navigating.Pathname.API.Challenges.mp4

@samuelstroschein
Copy link
Member Author

URL based localization (pathname, domain based, multi-tenancy) likely nailed!

I spent over 1 week on coming up with this API, and I think it nails any URL-based use case. Will make a decision tomorrow on whether to use URLPattern or path-to-regexp v8, which depends on pillarjs/path-to-regexp#349

  • one API to rule any url based needs
  • not >10 flags are different APIs that interfere in behavior (!)

Next steps

  • determine if path-to-regexp v8 can work with a baseLocale setting per pattern to combat ambiguous matches
  • else, try adoption of URLPattern
URL-Based.Localization.API.Update.-converted.mp4

@nosovk
Copy link

nosovk commented Feb 13, 2025

Any chance that #164 will land in 2.0?

@samuelstroschein
Copy link
Member Author

@nosovk replied in #164 (comment)

@samuelstroschein
Copy link
Member Author

#378 is shipped 🛥. This was the last big development effort that was needed.

Next up are simple bugfixes or features and write documentation. GA release by the end of February (2 weeks) is on track.

Image

@samuelstroschein
Copy link
Member Author

coming in paraglide js 2.0:

auto-import when writing m.

no more manual import * as m

Image

@CanRau

This comment has been minimized.

@zhihengGet

This comment has been minimized.

@samuelstroschein

This comment has been minimized.

@samuelstroschein
Copy link
Member Author

Implemented serverMiddleware(), no more adapters needed

I shipped #388 which exposes serverMiddleware() that works in any SSR framework. No more adapters. You read right. No more adapters.

import type { Handle } from '@sveltejs/kit';
+import { serverMiddleware } from '$lib/paraglide/runtime';

export const handle: Handle = ({ event, resolve }) => {
	return serverMiddleware(event.request, () => resolve(event));
};
Major.Update.on.Paraglide.js.mp4

Released as beta.19!

@zhihengGet

This comment has been minimized.

@WarningImHack3r

This comment has been minimized.

@samuelstroschein
Copy link
Member Author

automatic redirects with serverMiddleware()

The v2.0 API is really coming together. Everything works and is intuitive. This time: Automatic re-directs if the client has a defined locale but requested a URL for a different locale.

Localization.Strategy.Explained.mp4

@harrytran998

This comment has been minimized.

@samuelstroschein
Copy link
Member Author

Nesting and arbitrary key names support implemented

Surprise for v2. Long time awaited nesting of keys is now supported #285.

{
  "nested": {
    "key": "Nested key"
   }
}
import { m } from "./paraglide/messages.js";

console.log(m["nested.key"]());

You can even use emojis

import { m } from "./paraglide/messages.js"

m["🍌"]()

@mquandalle

This comment has been minimized.

@dvdzara

This comment has been minimized.

This comment has been minimized.

@samuelstroschein
Copy link
Member Author

samuelstroschein commented Mar 3, 2025

Paraglide JS GA release this or early next week

You can adopt Paraglide JS 2.0 already. The latest beta releases are stable.

The remaining tasks are mostly adding feature for SSG and creating a benchmark suite to test an experimental per locale splitting #425. Among the open issues:

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

Successfully merging a pull request may close this issue.