Documentation
¶
Index ¶
- func ExtractICUArguments(s string) []string
- func ExtractPlaceholders(s string) []string
- func ExtractTags(s string) []string
- func HasBalancedBraces(s string) bool
- func LooksLikeICU(s string) bool
- func MarkdownLinkDestinations(s string) []string
- type Issue
- type MarkdownLink
- type Pair
- type Result
- type Service
- type Severity
- type TagToken
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExtractICUArguments ¶
ExtractICUArguments returns unique ICU argument names found in s.
func ExtractPlaceholders ¶
ExtractPlaceholders returns unique placeholder tokens found in s.
func ExtractTags ¶
ExtractTags returns the unique normalized HTML-like tags in s.
func HasBalancedBraces ¶
HasBalancedBraces reports whether braces in s are balanced.
func LooksLikeICU ¶
LooksLikeICU reports whether s appears to contain an ICU message.
func MarkdownLinkDestinations ¶
MarkdownLinkDestinations returns unique Markdown link destinations in s.
Types ¶
type Issue ¶
type Issue struct {
Code string `json:"code"`
Message string `json:"message"`
Severity Severity `json:"severity"`
Locale string `json:"locale,omitzero"`
Namespace string `json:"namespace,omitzero"`
Key string `json:"key,omitzero"`
}
Issue describes one validation finding.
type MarkdownLink ¶
type MarkdownLink struct {
Raw string `json:"raw"`
Text string `json:"text"`
Destination string `json:"destination"`
}
MarkdownLink represents a Markdown inline link.
func ExtractMarkdownLinks ¶
func ExtractMarkdownLinks(s string) []MarkdownLink
ExtractMarkdownLinks returns Markdown inline links found in s.
type Pair ¶
type Pair struct {
SourceLocale string `json:"sourceLocale,omitzero"`
Locale string `json:"locale,omitzero"`
Namespace string `json:"namespace,omitzero"`
Key string `json:"key,omitzero"`
Source string `json:"source"`
Target string `json:"target"`
}
Pair contains a source string and target translation to validate.
type Result ¶
type Result struct {
OK bool `json:"ok"`
Issues []Issue `json:"issues,omitzero"`
Warnings []Issue `json:"warnings,omitzero"`
}
Result contains validation issues and warnings.
type Service ¶
type Service struct{}
Service validates translated strings.
func (*Service) ValidatePair ¶
ValidatePair validates a source and target translation pair.
type TagToken ¶
type TagToken struct {
Raw string `json:"raw"`
Name string `json:"name"`
Closing bool `json:"closing,omitzero"`
SelfClosing bool `json:"selfClosing,omitzero"`
Normalized string `json:"normalized"`
}
TagToken represents an HTML-like tag found in a translation string.
func ExtractTagTokens ¶
ExtractTagTokens returns normalized tag tokens found in s.