Skip to content

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

Description

@moaali

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?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions