We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
BCP 47 defines Tags for Identifying Languages.
Given the following JSON:
{ "language": "en", "foo": true }
j2s will currently output the following Swift code:
j2s
public struct Root { let foo: Bool let language: String init?(_ dictionary: [String: Any]) { if let foo = dictionary["foo"] as? Bool { self.foo = foo } else { return nil } if let language = dictionary["language"] as? String { self.language = language } else { return nil } } }
but it might be useful if could identify BCP 47 identifiers and instead output code using Locales, such as:
Locale
public struct Root { let foo: Bool let language: String init?(_ dictionary: [String: Any]) { if let foo = dictionary["foo"] as? Bool { self.foo = foo } else { return nil } if let language = dictionary["language"] as? String { Locale(localeIdentifier: language) } else { return nil } } }
The text was updated successfully, but these errors were encountered:
fixed by f0d5fa5
Sorry, something went wrong.
this was un-fixed after starting to generate Codable-compliant code
Codable
No branches or pull requests
BCP 47 defines Tags for Identifying Languages.
Given the following JSON:
j2s
will currently output the following Swift code:but it might be useful if could identify BCP 47 identifiers and instead output code using
Locale
s, such as:The text was updated successfully, but these errors were encountered: