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

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

Open
superarts opened this issue Nov 12, 2023 · 1 comment
Labels
Intermediate Developer to senior level

Comments

@superarts
Copy link
Owner

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"
          }
        }
      }
    },
@superarts superarts added the Advanced Tech lead to architect level label Nov 12, 2023
@superarts superarts changed the title Create Decodable Models to decode xcstrings JSON file StringCatalogEnum: Create Decodable Models to decode xcstrings JSON file Nov 12, 2023
@superarts superarts added Intermediate Developer to senior level and removed Advanced Tech lead to architect level labels Nov 12, 2023
superarts pushed a commit that referenced this issue Jan 1, 2024
superarts pushed a commit that referenced this issue Jan 1, 2024
@superarts
Copy link
Owner Author

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
Labels
Intermediate Developer to senior level
Projects
None yet
Development

No branches or pull requests

1 participant