diff options
author | Nick Snyder <nickdsnyder@gmail.com> | 2019-05-09 07:47:45 +0300 |
---|---|---|
committer | Nick Snyder <nickdsnyder@gmail.com> | 2019-05-09 07:47:45 +0300 |
commit | a8a5c0494b19b875416910c4f44b5de39504a6df (patch) | |
tree | 8165710aba631bf7e8eb014217539504491fb743 | |
parent | 20fdd68b429453657bbafe7db8513794c0d04626 (diff) |
remove LocalizeMessageID until extract can extract it
-rw-r--r-- | v2/i18n/localizer.go | 20 | ||||
-rw-r--r-- | v2/i18n/localizer_test.go | 6 |
2 files changed, 18 insertions, 8 deletions
diff --git a/v2/i18n/localizer.go b/v2/i18n/localizer.go index bd34567..8c3be3e 100644 --- a/v2/i18n/localizer.go +++ b/v2/i18n/localizer.go @@ -112,12 +112,13 @@ func (l *Localizer) LocalizeMessage(msg *Message) (string, error) { }) } +// TODO: uncomment this (and the test) when extract has been updated to extract these call sites too. // Localize returns a localized message. -func (l *Localizer) LocalizeMessageID(messageID string) (string, error) { - return l.Localize(&LocalizeConfig{ - MessageID: messageID, - }) -} +// func (l *Localizer) LocalizeMessageID(messageID string) (string, error) { +// return l.Localize(&LocalizeConfig{ +// MessageID: messageID, +// }) +// } // LocalizeWithTag returns a localized message and the language tag. func (l *Localizer) LocalizeWithTag(lc *LocalizeConfig) (string, language.Tag, error) { @@ -158,6 +159,15 @@ func (l *Localizer) LocalizeWithTag(lc *LocalizeConfig) (string, language.Tag, e return msg, tag, nil } + MessageID: messageID, + PluralCount: kv["PluralCount"], + TemplateData: args, + } + + return l.Localize(lc) + } +} + func (l *Localizer) getTemplate(id string, defaultMessage *Message) (language.Tag, *MessageTemplate) { // Fast path. // Optimistically assume this message id is defined in each language. diff --git a/v2/i18n/localizer_test.go b/v2/i18n/localizer_test.go index 0b3a6b7..546293d 100644 --- a/v2/i18n/localizer_test.go +++ b/v2/i18n/localizer_test.go @@ -567,9 +567,9 @@ func TestLocalizer_Localize(t *testing.T) { check(localizer.LocalizeMessage(test.conf.DefaultMessage)) } - if test.conf.MessageID != "" && reflect.DeepEqual(test.conf, &LocalizeConfig{MessageID: test.conf.MessageID}) { - check(localizer.LocalizeMessageID(test.conf.MessageID)) - } + // if test.conf.MessageID != "" && reflect.DeepEqual(test.conf, &LocalizeConfig{MessageID: test.conf.MessageID}) { + // check(localizer.LocalizeMessageID(test.conf.MessageID)) + // } }) } } |