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

Add support for fastlane metadata or other text files #12

Open
andrewtheis opened this issue Feb 16, 2024 · 3 comments
Open

Add support for fastlane metadata or other text files #12

andrewtheis opened this issue Feb 16, 2024 · 3 comments
Labels
⭐️ feature New feature or request
Milestone

Comments

@andrewtheis
Copy link
Contributor

No description provided.

@andrewtheis andrewtheis added the ⭐️ feature New feature or request label Feb 16, 2024
@andrewtheis andrewtheis added this to the 0.2.0 milestone Feb 16, 2024
@andrewtheis andrewtheis changed the title Add support for fastlane metadata files Add support for fastlane metadata or other text files Mar 2, 2024
@jonkan
Copy link

jonkan commented May 9, 2024

Hi! Thanks for creating this tool ♥️

I've tried it out a bit and think it's really good and just what I'm looking for. I've started to try and add support for translating text files, I would like it to support translating my fastlane metadata files.

I just got "something" working, and as the gpt3 model didn't do a very good job I also added (hacked) support for gpt4 which did a much better job.

My work-in-progress is here https://github.com/jonkan/swift-translate/tree/support-text-files-and-gpt4

What I got so far is this idea of a JSON Specification file, e.g. fastlane/MetadataLocalization.json:

{
    "files": [
        {
            "sourceLocale": "en-US",
            "sourceFileURL": "metadata/en-US/description.txt",
            "comment": "Please order the translated list of supported areas alphabetically.",
            "outputs": [
                {
                    "locale": "it-IT",
                    "fileURL": "metadata/it/description.txt"
                },
                {
                    "locale": "sv-SE",
                    "fileURL": "metadata/sv/description.txt"
                }
            ]
        }
    ]
}

and have

$ swift-translate /Users/jonasbromo/Development/Electricity-Prices/fastlane/MetadataLocalization.json`

output translations at:

fastlane/metadata/sv/description.txt
fastlane/metadata/it/description.txt

I'm a little short on time atm but I thought I'd reach out and let you know.
I'm happy to take input from you and refine this into a MR if you want.

Cheers,
Jonas

@andrewtheis
Copy link
Contributor Author

Hi @jonkan! Glad you found the tool useful.

For fastlane metadata, my original idea was it would just be an argument swift-translate fastlane-meta or something like that. And it would look in the source directory for files in fastlane/metadata/default, then output them for the target languages in the appropriate folders.

But, I do like the idea of a more explicit configuration scheme. Possibly a swift-translate.yml file - where you can configure all the files/folders you want to translate, the languages to translate them to, output configuration, the translation service to use, etc. This will take a bit more planning to execute.

Thanks for adding GPT-4 support! Looks like that was a pretty easy lift. If you want to separate out a PR for just that it would be helpful!

@jonkan
Copy link

jonkan commented May 15, 2024

I decided to go the specification route because:

  • I was afraid that hard-coding the fastlane metadata folder structure wouldn't be flexible enough and thought a simple specification file/scheme would be easy and achieve the same thing, just not hard-coding it into the tool.
  • I thought it would be good to have the ability to add a comment to each file entry. Like the strings in the string catalog.

I choose JSON just because it's easy to decode, with Codable. YAML would probably be a better format. I have very limited experience of i though. But yes, my initial attempt is too verbose. I would like to have a languages variable to put in the paths to fix that. What are your thoughts on this, what would you like to see for a PR?

Sure, I'll try to put together a PR with gpt-4 support soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
⭐️ feature New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants