kaandedeoglu / Shark

Swift CLI for strong-typing images, colors, storyboards, fonts and localizations
MIT License
381 stars 15 forks source link

String Catalogs #49

Open mickeyl opened 3 months ago

mickeyl commented 3 months ago

It would be nice to have support for the new string catalogues. They are a good addition, but fail to add typesafe enums like we do.

Introduction

mickeyl commented 1 week ago

Here's a format example:

{
  "sourceLanguage" : "en",
  "strings" : {
    "Choose date" : {
      "localizations" : {
        "de" : {
          "stringUnit" : {
            "state" : "translated",
            "value" : "Datum aussuchen"
          }
        }
      }
    },
    "Completed %lld%%" : {
      "localizations" : {
        "de" : {
          "stringUnit" : {
            "state" : "translated",
            "value" : "Komplettiert %lld"
          }
        }
      }
    },
    "Done!" : {
      "localizations" : {
        "de" : {
          "stringUnit" : {
            "state" : "needs_review",
            "value" : "Fertig!"
          }
        },
        "en" : {
          "stringUnit" : {
            "state" : "translated",
            "value" : "Ready!"
          }
        }
      }
    },
    "Pick another date" : {

    }
  },
  "version" : "1.0"
}
mickeyl commented 1 week ago

So this works now in principle, but I'm not sure whether it really is worth it. The new String Catalogue feature doesn't seem to be really cutting it. For me, it doesn't auto remove unused strings, the file only gets bigger. Manually removing a key isn't working either, you have to resort to edit the underlying .xcstrings file.

What are your experiences with this?