Swiftgen: Multiple inputs and outputs files for `strings`

Created on 10 Jul 2019  路  3Comments  路  Source: SwiftGen/SwiftGen

My goal is to have separate translations files for my main app and Siri Extension.

I have in my swiftgen.yml file:

strings:
  inputs: SiriExtension/Errors/en.lproj/Errors.strings
  outputs:
    templateName: flat-swift4
    output: SiriExtension/Errors/Errors.swift
    parameters:
        enumName: SiriError

strings:
  inputs: MainApp/Resources/en.lproj/Localizable.strings
  outputs:
    templateName: flat-swift4
    output: MainApp/Constants/Strings.swift

Despite including both of the strings commands in the file, only one is executed.
swiftgen config lint prints:

> 1 entry for command strings:
 $ swiftgen strings --templateName flat-swift4 --output MainApp/Constants/Strings.swift MainApp/Resources/en.lproj/Localizable.strings

What am I doing wrong?

question

Most helpful comment

Check the Configuration File Format documentation, for multiple invocations of the same command, you'll want something like:

strings:
  - inputs: SiriExtension/Errors/en.lproj/Errors.strings
    outputs:
      templateName: flat-swift4
      output: SiriExtension/Errors/Errors.swift
      parameters:
        enumName: SiriError
  - inputs: MainApp/Resources/en.lproj/Localizable.strings
    outputs:
      templateName: flat-swift4
      output: MainApp/Constants/Strings.swift

All 3 comments

Check the Configuration File Format documentation, for multiple invocations of the same command, you'll want something like:

strings:
  - inputs: SiriExtension/Errors/en.lproj/Errors.strings
    outputs:
      templateName: flat-swift4
      output: SiriExtension/Errors/Errors.swift
      parameters:
        enumName: SiriError
  - inputs: MainApp/Resources/en.lproj/Localizable.strings
    outputs:
      templateName: flat-swift4
      output: MainApp/Constants/Strings.swift

OK sorry, I must have missed it somehow.

Now the file is being generated, but the enum name is still the default L10n (I set the config file exactly as you wrote).

I found the problem, it should be params instead of parameters.

Was this page helpful?
0 / 5 - 0 ratings