Skip to content

Feature Request: Section Headers As Namespace #272

@archonitex

Description

@archonitex

It would be great to have an option to use Section Header as namespace for a key for strings.

Example desired output:

"Login.loginButton" = "Login";
"Login.emailAddressFieldHeader" = "Email Address";
"Login.passwordFieldHeader" = "Password";
"Login.forgotPassword" = "Forgot your password?";

Currently to get the desired output, Twine file format looks like this :

[[Login]]
	[Login.loginButton]
		en = Login
	[Login.emailAddressFieldHeader]
		en = Email Address
	[Login.passwordFieldHeader]
		en = Password
	[Login.forgotPassword]
		en = Forgot your password?

Feature requested would instead add the section header as a namespace for the key. Twine file format would look like this :

[[Login]]
	[loginButton]
		en = Login
	[emailAddressFieldHeader]
		en = Email Address
	[passwordFieldHeader]
		en = Password
	[forgotPassword]
		en = Forgot your password?

This is especially useful when Twine / Localizable strings are used with SwiftGen or other code generation tools. Example output of SwiftGen when we use namespaces :

internal enum Login {
    /// Login
    internal static let loginButton = L10n.tr("Localizable", "Login.loginButton")
    /// Email Address
    internal static let emailAddressFieldHeader = L10n.tr("Localizable", "Login.emailAddressFieldHeader")
    /// Forgot your password?
    internal static let forgotPassword = L10n.tr("Localizable", "Login.forgotPassword")
    /// Reset Password
    internal static let forgotPasswordButton = L10n.tr("Localizable", "Login.forgotPasswordButton")
    /// Enter the email associated with your SHOEBOX QuickTest account. If found, we’ll send you instructions on how to reset your password.
    internal static let forgotPasswordSubheader = L10n.tr("Localizable", "Login.forgotPasswordSubheader")

}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions