-
Notifications
You must be signed in to change notification settings - Fork 305
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
message/catalog: separate concerns of firstInSequence
The code really should be in catmsg. Expose the functionality there and remove from pacakge catalog. Use type aliases to make this work in a more convenient way. Change-Id: I250a5ae193e890ec0e20e8b04f3bd26c06448c7b Reviewed-on: https://go-review.googlesource.com/80595 Run-TryBot: Marcel van Lohuizen <[email protected]> Reviewed-by: Nigel Tao <[email protected]>
- Loading branch information
Showing
6 changed files
with
57 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// Copyright 2017 The Go Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style | ||
// license that can be found in the LICENSE file. | ||
|
||
// +build go1.9 | ||
|
||
package catalog | ||
|
||
import "golang.org/x/text/internal/catmsg" | ||
|
||
// A Message holds a collection of translations for the same phrase that may | ||
// vary based on the values of substitution arguments. | ||
type Message = catmsg.Message | ||
|
||
type firstInSequence = catmsg.FirstOf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
// Copyright 2017 The Go Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style | ||
// license that can be found in the LICENSE file. | ||
|
||
// +build !go1.9 | ||
|
||
package catalog | ||
|
||
import "golang.org/x/text/internal/catmsg" | ||
|
||
// A Message holds a collection of translations for the same phrase that may | ||
// vary based on the values of substitution arguments. | ||
type Message interface { | ||
catmsg.Message | ||
} | ||
|
||
func firstInSequence(m []Message) catmsg.Message { | ||
a := []catmsg.Message{} | ||
for _, m := range m { | ||
a = append(a, m) | ||
} | ||
return catmsg.FirstOf(a) | ||
} |