Skip to content

Add support for string arrays #30

@RussellZornes

Description

@RussellZornes

A way to deal with string arrays would be useful.

For example say I want strings for days of the week...

The json might look like...

{
  "days_of_week": [
    {"monday": "Monday"},
    {"tuesday":  "Tuesday"},
    {"wednesday": "Wednesday"},
    {"thursday": "Thursday"},
    {"friday": "Friday"},
    {"saturday": "Saturday"},
    {"sunday": "Sunday"},
  ]
}

In code the strings would be accessed as...

Translation.of(context).daysOfWeek[index];

What would be even better would be to support aliases. This would allow the members of the array to reference string literals already defined.,

{
    "monday": "Monday",
    "tuesday":  "Tuesday",
    "wednesday": "Wednesday",
    "thursday": "Thursday",
    "friday": "Friday",
    "saturday": "Saturday",
    "sunday": "Sunday",
    "days_of_week": [
      {"monday": "@string/monday"},
      {"tuesday":  "@string/tuesday"},
      {"wednesday": "@string/wednesday"},
      {"thursday": "@string/thursday"},
      {"friday": "@string/friday"},
      {"saturday": "@string/saturday"},
      {"sunday": "@string/sunday"},
    ]
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions