-
Notifications
You must be signed in to change notification settings - Fork 83
Conversation
Adds a few default translations for demonstration
@@ -35,7 +35,7 @@ | |||
</div> | |||
{{end}} | |||
|
|||
<h1>Create verification code</h1> | |||
<h1>{{t $.locale "create-verification-code"}}</h1> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not in love with having to pass in the locale, but template functions aren't mutable after creation.
// translate accepts a message printer (populated by middleware) and prints the | ||
// translated text for the given key. If the printer is nil, an error is | ||
// returned. | ||
func translate(l *gotext.Locale, key string, vars ...interface{}) (string, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is important because the default behavior is to just return the empty string, which is a pretty difficult-to-debug failure. I'd like the template execution to fail on missing i18n keys.
"Content-Transfer-Encoding: 8bit\n" | ||
"Plural-Forms: nplurals=2; plural=(n != 1);\n" | ||
|
||
msgid "create-verification-code" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd like to come up with a better grouping for these. I thought about header.create-verification-code
or something to make it clearer.
msgstr "Diagnóstico" | ||
|
||
msgid "dates" | ||
msgstr "Fechas" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice spanish
"MIME-Version: 1.0\n" | ||
"Content-Type: text/plain; charset=UTF-8\n" | ||
"Content-Transfer-Encoding: 8bit\n" | ||
"Plural-Forms: nplurals=2; plural=(n != 1);\n" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what is this Plural-Forms doing?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nothing right now. But if you ever had a sentence like:
There were %d bananas
You'd want to define:
=0
"There were no bananas"=1
"There was 1 banana">1
"There were %d bananas"
That's what plurals do. It's part of the gettext standard: https://www.gnu.org/software/gettext/manual/html_node/Translating-plural-forms.html
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: sethvargo, whaught The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Adds a few default translations for demonstration
Fixes #1083
Release Note