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

Feature Request: Section Headers As Namespace #272

Open
archonitex opened this issue Mar 29, 2019 · 1 comment
Open

Feature Request: Section Headers As Namespace #272

archonitex opened this issue Mar 29, 2019 · 1 comment

Comments

@archonitex
Copy link

archonitex commented Mar 29, 2019

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")

}
@Kolyall
Copy link

Kolyall commented Mar 11, 2020

its useful for iOS , but not for android
also some iOS devs like to set to Section something like: MARK: MyController for quick navigate from generated files from SwiftGen
for example

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants