Skip to content

StringCatalogEnum: Create Decodable Models to decode xcstrings JSON file #1

Description

@superarts

Currently, only first level keys in the strings object are used to generate enum.

Decodable models should be created so that xcstrings JSON file can be decoded to native objects, to support more features.

For example, if we can extract $key.localizations.en.stringUnit.value, we can add inline documents to enum case, so that when developer option-click a case name, the whole copy of a chosen language (en in this case) will be displayed.

Formats to be supported

Generated from SwiftUI

    "Home" : {

    },

Generated from SwiftUI, and an English translation is added

    "Login" : {
      "localizations" : {
        "en" : {
          "stringUnit" : {
            "state" : "translated",
            "value" : "Login"
          }
        }
      }
    }

Manually added, English only

    "welcomeBack" : {
      "extractionState" : "manual",
      "localizations" : {
        "en" : {
          "stringUnit" : {
            "state" : "translated",
            "value" : "Welcome back"
          }
        }
      }
    },

Activity

  1. changed the title [-]Create Decodable Models to decode xcstrings JSON file[/-] [+]StringCatalogEnum: Create Decodable Models to decode xcstrings JSON file[/+] on Nov 12, 2023
  2. added
    IntermediateDeveloper to senior level
    and removed
    AdvancedTech lead to architect level
    on Nov 12, 2023
  3. added 2 commits that reference this issue on Jan 1, 2024
  4. superarts commented on Jan 5, 2024

    @superarts
    OwnerAuthor

    Thank you @Uni-boy for your PR! We have some remaining works that will be addressed in future: #14 (comment)

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

    IntermediateDeveloper to senior level

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions