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

[Question] How can a variable be referenced in terms params? #628

Open
moaali opened this issue Mar 16, 2024 · 0 comments
Open

[Question] How can a variable be referenced in terms params? #628

moaali opened this issue Mar 16, 2024 · 0 comments

Comments

@moaali
Copy link

moaali commented Mar 16, 2024

I'm trying to add translation to Arabic project, in arabic there are 6 versions of the same word that is variable of both gender and count for example:

[female]
  [1] v1
  [2] v2
  [other] v3
[male]
  [1] v4
  [2] v5
  [other] v6

the FTL I used to achieve the result:

-add-text-female = {
  $count ->
    [1] اضافت
    [2] اضافتا
    *[other] اضفن
}

-add-text-male = {
  $count ->
    [1] اضاف
    [2] اضافا
    *[other] اضافوا
}

notification-body = {$members} {
  $gender ->
    [male] {-add-text-male(count: $membersCount)}
    [female] {-add-text-female(count: $membersCount)}
    *[other] {-add-text-male}
} {
  $count ->
    [one] منتج واحد
    [two] منتجين
    [few] {$countDisplay} منتجات
    [many] {$countDisplay} منتج
    *[other] {$countDisplay} منتج
}

the above works fine only if I passed the value of $membersCount variable to the term (i.e. {-add-text-male(count: 2)}) but when I use the variable name it doesn't work, I tried to search in the docs on how to reference variable in terms but I didn't find anything.

So my question is, is it possible achieve the result I'm after using the dynamic value of $membersCount in terms? if so, what is the correct syntax?
If not possible how similar result could be achieved?

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

No branches or pull requests

1 participant