Expression files
Store built-in component labels and messages in JSON or YAML, then load them as an expressions.Set. Your application chooses which set to use; Goshtoso supplies English text for fields you leave unspecified.
Load and render
Create locales/pt.yaml with the text you want to replace. Group and property names match the Go API exactly, including capitalization. This file replaces the empty-state title and description, along with three pagination labels.
# yaml-language-server: $schema=./expressions.schema.json
EmptyState:
Title: Ainda não há nada aqui
Description: Os itens aparecerão aqui quando estiverem disponíveis.
Pagination:
NextLabel: Próxima
NextAriaLabel: Próxima página
PageAriaLabel: Página {page}Save the following program as main.go beside the locales directory. It embeds the YAML file in the executable, loads the expressions, and writes an empty-state component’s HTML to standard output. The rendered title and description come from the file.
package main
import (
"context"
"embed"
"log"
"os"
"github.com/araihu/goshtoso/components/emptystate"
"github.com/araihu/goshtoso/expressions"
)
//go:embed locales/pt.yaml
var locales embed.FS
func main() {
set, err := expressions.LoadFS(locales, "locales/pt.yaml")
if err != nil {
log.Fatal(err)
}
renderer := expressions.NewRenderer(set)
component := emptystate.EmptyState(emptystate.Config{})
if err := renderer.Render(context.Background(), os.Stdout, component); err != nil {
log.Fatal(err)
}
}In a web application, create the renderer at startup and reuse it in your handlers, passing the request context and response writer to Render. To support several languages, load each file once and choose a set for each request.
See the Internationalization guide to configure application defaults and request overrides, or try the live examples.
Files and byte slices
LoadFS accepts any fs.FS, including embed.FS and os.DirFS. Use LoadFile when you have a disk path, or ParseJSON and ParseYAML when the contents are already available as []byte. The file loaders select the format from the .json, .yaml, or .yml extension. All four functions return (Set, error); check the error before using the set.
JSON uses the same groups and properties as YAML. For example, these are the pagination overrides from the YAML file above:
{
"$schema": "./expressions.schema.json",
"Pagination": {
"NextLabel": "Próxima",
"NextAriaLabel": "Próxima página",
"PageAriaLabel": "Página {page}"
}
}Omitted fields and empty strings leave existing defaults in place. A loaded set contains only the supplied overrides, so it can also be passed to expressions.With or combined with another set using expressions.Merge.
Messages with values
Some messages include a value supplied by the component. Pagination.PageAriaLabel uses {page}: “Página {page}” produces “Página 3” for page 3. Each message accepts only the placeholder listed in the reference below. Use {{ and }} to include literal braces.
File messages substitute values as text. For plural forms or locale-specific number formatting, assign a Go callback to the field after loading the set.
Validation and property reference
The loaders reject unknown or duplicate properties, nulls, non-string expressions, invalid placeholders, and multiple documents. In YAML, quote numbers and booleans when you intend them as text. YAML aliases and merge keys are not supported.
Download the JSON Schema to use it in your editor.
Save the schema as expressions.schema.json beside your translation files. The YAML comment and JSON $schema property shown above associate the file with the schema in editors that support it, enabling property completion and validation while you edit. You can also obtain the schema with expressions.JSONSchema(). The loaders validate the input themselves and do not fetch the $schema URL.
Expand a component below to see its supported properties, English defaults, and message placeholders.
$schemastring optionalOptional editor schema reference. Goshtoso does not fetch this URL.
ActionGroupobject optionalActionGroup expressions. Omitted or empty fields inherit defaults.
AriaLabelstring optionalAriaLabel defaults to "Actions".
- English
Actions
OverflowAriaLabelstring optionalOverflowAriaLabel defaults to "More actions".
- English
More actions
Alertobject optionalAlert expressions. Omitted or empty fields inherit defaults.
DismissAriaLabelstring optionalDismissAriaLabel defaults to "dismiss alert".
- English
dismiss alert
DismissLabelstring optionalDismissLabel defaults to "Dismiss".
- English
Dismiss
AppShellobject optionalAppShell expressions. Omitted or empty fields inherit defaults.
SkipLinkLabelstring optionalSkipLinkLabel defaults to "Skip to main content".
- English
Skip to main content
Avatarobject optionalAvatar expressions. Omitted or empty fields inherit defaults.
GroupAriaLabelstring optionalGroupAriaLabel defaults to "Avatar group".
- English
Avatar group
Badgeobject optionalBadge expressions. Omitted or empty fields inherit defaults.
NotificationAriaLabelstring optionalNotificationAriaLabel defaults to "notification".
- English
notification
Bannerobject optionalBanner expressions. Omitted or empty fields inherit defaults.
AcceptLabelstring optionalAcceptLabel defaults to "Accept".
- English
Accept
ConsentAriaLabelstring optionalConsentAriaLabel defaults to "Cookie consent".
- English
Cookie consent
DismissAriaLabelstring optionalDismissAriaLabel defaults to "dismiss banner".
- English
dismiss banner
RejectLabelstring optionalRejectLabel defaults to "Decline".
- English
Decline
Titlestring optionalTitle defaults to "Cookie Consent".
- English
Cookie Consent
Breadcrumbsobject optionalBreadcrumbs expressions. Omitted or empty fields inherit defaults.
AriaLabelstring optionalAriaLabel defaults to "breadcrumb".
- English
breadcrumb
Carouselobject optionalCarousel expressions. Omitted or empty fields inherit defaults.
LoadingTextstring optionalLoadingText defaults to "Loading carousel...".
- English
Loading carousel...
NextAriaLabelstring optionalNextAriaLabel defaults to "next slide".
- English
next slide
PauseAriaLabelstring optionalPauseAriaLabel defaults to "pause carousel".
- English
pause carousel
PlayAriaLabelstring optionalPlayAriaLabel defaults to "play carousel".
- English
play carousel
PreviousAriaLabelstring optionalPreviousAriaLabel defaults to "previous slide".
- English
previous slide
SlideLabelstring optionalSlideLabel returns the carousel counter text for slide. Rendering prepares values from zero through the number of slides; visible slide numbers start at one. In files, use {slide} for the argument and {{ or }} for literal braces. An empty string inherits the default.
- English message
slide {slide}- Placeholder
{slide}
SlidesAriaLabelstring optionalSlidesAriaLabel defaults to "slides".
- English
slides
ChatBubbleobject optionalChatBubble expressions. Omitted or empty fields inherit defaults.
BotLabelstring optionalBotLabel defaults to "BOT".
- English
BOT
DeliveredLabelstring optionalDeliveredLabel defaults to "Delivered".
- English
Delivered
SeenLabelstring optionalSeenLabel defaults to "Seen".
- English
Seen
SendingLabelstring optionalSendingLabel defaults to "Sending".
- English
Sending
TypingAriaLabelstring optionalTypingAriaLabel defaults to "typing".
- English
typing
CodeBlockobject optionalCodeBlock expressions. Omitted or empty fields inherit defaults.
CopiedLabelstring optionalCopiedLabel defaults to "Copied!".
- English
Copied!
CopyAriaLabelstring optionalCopyAriaLabel returns the copy button’s accessible name for the code block header label, or its ID when no label is available. In files, use {label} for the argument and {{ or }} for literal braces. An empty string inherits the default.
- English message
Copy {label} code- Placeholder
{label}
CopyLabelstring optionalCopyLabel defaults to "Copy".
- English
Copy
ErrorTextstring optionalErrorText defaults to "Unable to copy".
- English
Unable to copy
Comboboxobject optionalCombobox expressions. Omitted or empty fields inherit defaults.
ClearLabelstring optionalClearLabel defaults to "Clear all".
- English
Clear all
EmptyTextstring optionalEmptyText defaults to "No matches found".
- English
No matches found
ErrorTextstring optionalErrorText defaults to "Failed to load.".
- English
Failed to load.
Placeholderstring optionalPlaceholder defaults to "Select…".
- English
Select…
RetryLabelstring optionalRetryLabel defaults to "Retry".
- English
Retry
SearchPlaceholderstring optionalSearchPlaceholder defaults to "Search…".
- English
Search…
SelectedLabelstring optionalSelectedLabel returns the complete selection summary for count selected values. It must handle zero and positive counts; client components prepare all possible counts during rendering. In files, use {count} for the argument and {{ or }} for literal braces. An empty string inherits the default.
- English message
{count} selected- Placeholder
{count}
Drawerobject optionalDrawer expressions. Omitted or empty fields inherit defaults.
CloseAriaLabelstring optionalCloseAriaLabel defaults to "Close".
- English
Close
Dropdownobject optionalDropdown expressions. Omitted or empty fields inherit defaults.
ContextMenuAriaLabelstring optionalContextMenuAriaLabel defaults to "context menu".
- English
context menu
OpenMenuAriaLabelstring optionalOpenMenuAriaLabel defaults to "open menu".
- English
open menu
EmptyStateobject optionalEmptyState expressions. Omitted or empty fields inherit defaults.
Descriptionstring optionalDescription defaults to "Items will appear here when they are available.".
- English
Items will appear here when they are available.
Titlestring optionalTitle defaults to "Nothing here yet".
- English
Nothing here yet
FileInputobject optionalFileInput expressions. Omitted or empty fields inherit defaults.
BrowseLabelstring optionalBrowseLabel defaults to "Browse".
- English
Browse
DropTextstring optionalDropText defaults to " or drag and drop here".
- English
or drag and drop here
EmptyTextstring optionalEmptyText defaults to "No file selected".
- English
No file selected
Formobject optionalForm expressions. Omitted or empty fields inherit defaults.
DoneLabelstring optionalDoneLabel defaults to "Done".
- English
Done
EditLabelstring optionalEditLabel defaults to "Edit".
- English
Edit
ErrorTitlestring optionalErrorTitle defaults to "Validation failed".
- English
Validation failed
Modalobject optionalModal expressions. Omitted or empty fields inherit defaults.
CloseAriaLabelstring optionalCloseAriaLabel defaults to "close modal".
- English
close modal
DialogCloseAriaLabelstring optionalDialogCloseAriaLabel defaults to "Close dialog".
- English
Close dialog
Navbarobject optionalNavbar expressions. Omitted or empty fields inherit defaults.
AriaLabelstring optionalAriaLabel defaults to "main navigation".
- English
main navigation
CloseMenuAriaLabelstring optionalCloseMenuAriaLabel defaults to "Close mobile menu".
- English
Close mobile menu
OpenMenuAriaLabelstring optionalOpenMenuAriaLabel defaults to "Open mobile menu".
- English
Open mobile menu
SecondaryAriaLabelstring optionalSecondaryAriaLabel defaults to "secondary navigation".
- English
secondary navigation
UserMenuAriaLabelstring optionalUserMenuAriaLabel defaults to "user menu".
- English
user menu
Paginationobject optionalPagination expressions. Omitted or empty fields inherit defaults.
AriaLabelstring optionalAriaLabel defaults to "pagination".
- English
pagination
MoreAriaLabelstring optionalMoreAriaLabel defaults to "more pages".
- English
more pages
NextAriaLabelstring optionalNextAriaLabel defaults to "next page".
- English
next page
NextLabelstring optionalNextLabel defaults to "Next".
- English
Next
PageAriaLabelstring optionalPageAriaLabel returns the accessible name for a page link. Page numbers start at one. In files, use {page} for the argument and {{ or }} for literal braces. An empty string inherits the default.
- English message
page {page}- Placeholder
{page}
PreviousAriaLabelstring optionalPreviousAriaLabel defaults to "previous page".
- English
previous page
PreviousLabelstring optionalPreviousLabel defaults to "Previous".
- English
Previous
Paletteobject optionalPalette expressions. Omitted or empty fields inherit defaults.
BlackLabelstring optionalBlackLabel defaults to "black".
- English
black
CustomLabelstring optionalCustomLabel defaults to "Custom color".
- English
Custom color
Placeholderstring optionalPlaceholder defaults to "Pick a color".
- English
Pick a color
ResetLabelstring optionalResetLabel defaults to "Reset".
- English
Reset
WhiteLabelstring optionalWhiteLabel defaults to "white".
- English
white
Popoverobject optionalPopover expressions. Omitted or empty fields inherit defaults.
TriggerLabelstring optionalTriggerLabel defaults to "Open".
- English
Open
Ratingobject optionalRating expressions. Omitted or empty fields inherit defaults.
DissatisfiedLabelstring optionalDissatisfiedLabel defaults to "dissatisfied".
- English
dissatisfied
Labelstring optionalLabel defaults to "Rating".
- English
Rating
NeutralLabelstring optionalNeutralLabel defaults to "neutral".
- English
neutral
SatisfiedLabelstring optionalSatisfiedLabel defaults to "satisfied".
- English
satisfied
StarLabelstring optionalStarLabel returns the complete label for a star rating value. Values include zero for an unrated display and run through the configured maximum. In files, use {value} for the argument and {{ or }} for literal braces. An empty string inherits the default.
- English message
{value} stars- Placeholder
{value}
VeryDissatisfiedLabelstring optionalVeryDissatisfiedLabel defaults to "very dissatisfied".
- English
very dissatisfied
VerySatisfiedLabelstring optionalVerySatisfiedLabel defaults to "very satisfied".
- English
very satisfied
SchemaFormobject optionalSchemaForm expressions. Omitted or empty fields inherit defaults.
AddLabelstring optionalAddLabel defaults to "+ Add item".
- English
+ Add item
DefaultLabelstring optionalDefaultLabel returns the default-value annotation for a schema field. The argument is the field’s default value as supplied by the application. In files, use {value} for the argument and {{ or }} for literal braces. An empty string inherits the default.
- English message
default: {value}- Placeholder
{value}
ItemPlaceholderstring optionalItemPlaceholder defaults to "item".
- English
item
ManagedLabelstring optionalManagedLabel defaults to "managed".
- English
managed
ManagedTitlestring optionalManagedTitle defaults to "Managed by platform — cannot override".
- English
Managed by platform — cannot override
RequiredAriaLabelstring optionalRequiredAriaLabel defaults to "required".
- English
required
SchemaTreeobject optionalSchemaTree expressions. Omitted or empty fields inherit defaults.
DeprecatedLabelstring optionalDeprecatedLabel defaults to "deprecated".
- English
deprecated
NullableLabelstring optionalNullableLabel defaults to "nullable".
- English
nullable
OptionalLabelstring optionalOptionalLabel defaults to "optional".
- English
optional
RequiredLabelstring optionalRequiredLabel defaults to "required".
- English
required
Searchobject optionalSearch expressions. Omitted or empty fields inherit defaults.
EmptyTextstring optionalEmptyText defaults to "No results found.".
- English
No results found.
EscapeTextstring optionalEscapeText defaults to "Esc".
- English
Esc
Labelstring optionalLabel defaults to "Search".
- English
Search
Placeholderstring optionalPlaceholder defaults to "Search".
- English
Search
ResultsAriaLabelstring optionalResultsAriaLabel returns the results region’s accessible name from the search control’s resolved label. In files, use {label} for the argument and {{ or }} for literal braces. An empty string inherits the default.
- English message
{label} results- Placeholder
{label}
ShortcutTextstring optionalShortcutText defaults to "⌘ K".
- English
⌘ K
Selectobject optionalSelect expressions. Omitted or empty fields inherit defaults.
ListAriaLabelstring optionalListAriaLabel returns the option list’s accessible name from the select control’s configured label, which may be empty. In files, use {label} for the argument and {{ or }} for literal braces. An empty string inherits the default.
- English message
{label} list- Placeholder
{label}
Placeholderstring optionalPlaceholder defaults to "Please Select".
- English
Please Select
Sidebarobject optionalSidebar expressions. Omitted or empty fields inherit defaults.
ActiveLabelstring optionalActiveLabel defaults to "active".
- English
active
AriaLabelstring optionalAriaLabel defaults to "sidebar navigation".
- English
sidebar navigation
SearchAriaLabelstring optionalSearchAriaLabel defaults to "Search".
- English
Search
SkipLabelstring optionalSkipLabel defaults to "skip to the main content".
- English
skip to the main content
TriggerLabelstring optionalTriggerLabel defaults to "Open sidebar".
- English
Open sidebar
Skeletonobject optionalSkeleton expressions. Omitted or empty fields inherit defaults.
AriaLabelstring optionalAriaLabel defaults to "Loading content".
- English
Loading content
SplitButtonobject optionalSplitButton expressions. Omitted or empty fields inherit defaults.
MenuAriaLabelstring optionalMenuAriaLabel defaults to "More actions".
- English
More actions
Stepsobject optionalSteps expressions. Omitted or empty fields inherit defaults.
AriaLabelstring optionalAriaLabel defaults to "progress".
- English
progress
CompletedLabelstring optionalCompletedLabel defaults to "completed".
- English
completed
StructuredInputobject optionalStructuredInput expressions. Omitted or empty fields inherit defaults.
AddLabelstring optionalAddLabel defaults to "Add row".
- English
Add row
RemoveAriaLabelstring optionalRemoveAriaLabel defaults to "Remove row".
- English
Remove row
Tableobject optionalTable expressions. Omitted or empty fields inherit defaults.
ActionsLabelstring optionalActionsLabel defaults to "Actions".
- English
Actions
FiltersLabelstring optionalFiltersLabel defaults to "Filters".
- English
Filters
LoadMoreLabelstring optionalLoadMoreLabel defaults to "Load more".
- English
Load more
LoadingTextstring optionalLoadingText defaults to "Loading...".
- English
Loading...
OpenRowLabelstring optionalOpenRowLabel returns the screen-reader text for opening a table row. rowID is empty when the row has no ID. In files, use {rowID} for the argument and {{ or }} for literal braces. An empty string inherits the default.
- English message
Open row {rowID}- Placeholder
{rowID}
Tabsobject optionalTabs expressions. Omitted or empty fields inherit defaults.
LoadingTextstring optionalLoadingText defaults to "Loading...".
- English
Loading...
OptionsAriaLabelstring optionalOptionsAriaLabel defaults to "tab options".
- English
tab options
TagsListobject optionalTagsList expressions. Omitted or empty fields inherit defaults.
AddLabelstring optionalAddLabel defaults to "Add".
- English
Add
Placeholderstring optionalPlaceholder defaults to "Add a tag...".
- English
Add a tag...
RemoveAriaLabelstring optionalRemoveAriaLabel defaults to "Remove tag".
- English
Remove tag
TextInputobject optionalTextInput expressions. Omitted or empty fields inherit defaults.
SearchAriaLabelstring optionalSearchAriaLabel defaults to "search".
- English
search
ShowPasswordAriaLabelstring optionalShowPasswordAriaLabel defaults to "Show password".
- English
Show password
Textareaobject optionalTextarea expressions. Omitted or empty fields inherit defaults.
AttachAriaLabelstring optionalAttachAriaLabel defaults to "Attach a file".
- English
Attach a file
EmojiAriaLabelstring optionalEmojiAriaLabel defaults to "Emojis".
- English
Emojis
SendAriaLabelstring optionalSendAriaLabel defaults to "send".
- English
send
SendLabelstring optionalSendLabel defaults to "Send".
- English
Send
VoiceAriaLabelstring optionalVoiceAriaLabel defaults to "Send voice".
- English
Send voice
Toastobject optionalToast expressions. Omitted or empty fields inherit defaults.
DismissAriaLabelstring optionalDismissAriaLabel defaults to "dismiss notification".
- English
dismiss notification
DismissLabelstring optionalDismissLabel defaults to "Dismiss".
- English
Dismiss
Toolbarobject optionalToolbar expressions. Omitted or empty fields inherit defaults.
AriaLabelstring optionalAriaLabel defaults to "Page tools".
- English
Page tools
Tooltipobject optionalTooltip expressions. Omitted or empty fields inherit defaults.
TriggerLabelstring optionalTriggerLabel defaults to "Hover Me".
- English
Hover Me