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 Message Reference (Linguini extension of Fluent) #27

Closed
Ygg01 opened this issue Feb 23, 2023 · 0 comments · Fixed by #39
Closed

Add Message Reference (Linguini extension of Fluent) #27

Ygg01 opened this issue Feb 23, 2023 · 0 comments · Fixed by #39

Comments

@Ygg01
Copy link
Owner

Ygg01 commented Feb 23, 2023

Motivated by space-wizards/RobustToolbox#2273
Seeing discussion in:

Problem

Let's say we have following message:

-cat = {$number ->
  *[one] Cat
  [other] Cats
}
-dog = {$number -> 
  *[one] Dog
  [other] Dogs
}

# We want message to be X attacked Y
attack-log-cat1-cat1 = Cat attacked cat.
attack-log-cat1-cat2 = Cat attacked cats.
attack-log-dog1-cat1 = Dog attacked cat.
attack-log-dog1-cat2 = Dog attacked cats.
# Etc.

This leads to combinatorial explosion. Instead we want something like

attack-log = { $$attacker(number: $atk_num) } attacked {$$defender(number: $def_num)}.

And then we pass following values into bundle

{
  "attacker": "-dog",
  "atk_num": 1,
  "defender": "-dog",
  "def_num": 2
}

Solution

I've decided to move the needle by:
A) Introducing a new fluent type called LinguiniReference
B) Introducing experimental syntax for start $$attacker which must be a Linguini reference. Plus allowing complex nesting like
$$attacker(number: $$something.Num) and access to attributes like so $$msg_id.Value
C) Create fast serialization of messages

Note: This is experimental syntax and will be probably changed depending on how it works out.

@Ygg01 Ygg01 mentioned this issue Oct 24, 2023
@Ygg01 Ygg01 closed this as completed in #39 Oct 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant