Skip to content

Internationalization ​

Location
/etc/blacklab/projectconfigs/
└─ 
corpus-1/
   β”œβ”€ 
search.xml
   β”œβ”€ 
help.inc
   β”œβ”€ 
about.inc
   β”œβ”€ 
article.xsl
   β”œβ”€ 
meta.xsl
   β”œβ”€ 
static/
   |  β”œβ”€ 
locales/
   |  |  β”œβ”€ 
en-us.json
   |  |  └─ 
...
   |  └─ 
...
   β”œβ”€ 
corpus-2/
   β”œβ”€ 
corpus-3/
   β”œβ”€ 
...
   β”œβ”€ 
default/
   |  β”œβ”€ 
search.xml
   |  └─ 
...
   └─ 
...
<--- The location set in the corporaInterfaceDataDir setting
<--- Exact name/ID of the corpus as in BlackLab
Β 
Β 
Β 
Β 
Β 
Β 
<--- Language files for the interface, specific to this corpus
Β 
Β 
<--- Anything else you want to make available client-side
Β 
Β 
Β 
<--- Fallbacks / Defaults go here
Β 
Β 
Β 

You can customize field names, labels, and other UI text by creating a locale file. Any keys you provide will override the default locale.
If you fully translate the UI, please consider sharing your translation.

Default en-us locale file github
json
{
	"corpora": {
		"loading": "Loading corpora…"
	},
	"corpus": {
		"loading": "Please wait while we load the corpus..."
	},
	"widgets": {
		"learnMore": "Learn more",
		"clickToRemove": "Click to remove",
		"selectValue": "Select a value...",
		"selectValues": "Select value(s)...",
		"caseSensitive": "@:annotation.caseSensitive"
	},
	"search": {
		"heading": "Search for …",
		"simple": {
			"heading": "Simple"
		},
		"extended": {
			"heading": "Extended",
			"within": "Within:",
			"withinDocument": "Document"
		},
		"advanced": {
			"heading": "Advanced",

			"queryBuilder": {
				"createTokenButton_label": "Insert another token",

				"modalEditor_title": "Edit",
				"modalEditor_clear": "Clear",
				"modalEditor_cancel": "Cancel",
				"modalEditor_save": "Save changes",

				"token_head_move_right_title": "Move this token one position to the right",
				"token_head_move_left_title": "Move this token one position to the left",
				"token_head_deleteButton_title": "Remove token",

				"body_tab_header_search": "Search",
				"body_tab_header_properties": "Context",

				"body_tab_properties_optional": "Optional",
				"body_tab_properties_optional_title": "Token is optional",
				"body_tab_properties_beginOfSentence": "Begin of sentence",
				"body_tab_properties_beginOfSentence_title": "Token must occur at the beginning of a sentence",
				"body_tab_properties_endOfSentence": "End of sentence",
				"body_tab_properties_endOfSentence_title": "Token must occur at the end of a sentence",

				"body_tab_properties_repeats_label": "repeats",
				"body_tab_properties_repeats_to": "to",
				"body_tab_properties_repeats_times": "times",

				"attribute_caseAndDiacriticsSensitive": "Case-\u00a0and\u00a0diacritics-sensitive",
				"attribute_delete_attribute_button_title": "Remove this attribute",

				"attribute_file_upload_button_title": "Upload a list of values",
				"attribute_file_upload_edit_button_title": "Edit your uploaded values",

				"attribute_create_button_title": "Add another attribute",

				"boolean_operators": {
					"&": "AND",
					"|": "OR"
				},
				"comparators": {
					"=": "=",
					"!=": "β‰ ",
					"startsWith": "starts with",
					"endsWith": "ends with"
				}
			}
		},
		"expert": {
			"heading": "Expert",
			"corpusQueryLanguage": "Corpus Query Language"
		},
		"parallel": {
			"alignBy": "Align by",
			"searchSourceVersion": "Search source version",
			"errorNoSourceVersion": "Please select a source version.",
			"andCompareWithTargetVersions": "And compare with target version(s)"
		}
	},
	"filter": {
		"heading": "Filter search by …",
		"range": {
			"from": "From",
			"to": "To",
			"permissive": "Permissive",
			"permissiveDescription": "Matches documents that are partially contained within the entered range",
			"strict": "Strict",
			"strictDescription": "Matches documents that are completely contained within the entered range"
		}
	},
	"explore": {
		"heading": "Explore ...",
		"corpora": {
			"heading": "Documents",
			"groupBy": "Group documents by metadata",
			"showAs": {
				"heading": "Show groups as",
				"table": "Table",
				"docs": "Docs",
				"tokens": "Tokens"
			}
		},
		"ngram": {
			"heading": "N-grams",
			"ngramSize": "N-gram size",
			"ngramType": "N-gram type"
		},
		"frequency": {
			"heading": "Statistics",
			"frequencyType": "Frequency list type"
		}
	},
	"setting": {
		"heading": "Global settings",
		"resultsPerPage": "Results per page",
		"sampleSize": "Sample size",
		"sampleSizeCount": "count",
		"sampleSizePercentage": "percentage",
		"sampleSeed": "Seed",
		"context": "Context size",
		"wideView": "Wide View",
		"debug": "Debug info",
		"debugLogCategories": "Debug log categories",
		"debugLogCategoriesAll": "All",
		"hideDebugUntilReload": "Hide debug checkbox until next reload",
		"close": "Close"
	},
	"queryForm": {
		"search": "Search",
		"explore": "Explore",
		"collocations": "Collocations",
		"reset": "Reset",
		"history": "History"
	},
	"collocations": {
		"heading": "Collocation search",
		"sections": {
			"keyword": "Word or construction",
			"collocate": "Optional collocate restriction",
			"context": "Context and calculation"
		},
		"patternMode": "Pattern input mode",
		"modes": {
			"simple": "Simple",
			"advanced": "Advanced",
			"expert": "Expert BCQL"
		},
		"patternAnnotation": "Annotation",
		"preparingAdvanced": "Preparing the query builder…",
		"advancedParseError": "This pattern could not be transferred to the query builder. You can continue in Simple or Expert mode.",
		"restrictCollocate": "Restrict which collocates are counted",
		"singleTokenCollocateHelp": "The collocate pattern must match a single token for BlackLab to calculate association scores. You can combine conditions such as lemma and part of speech on that token. The keyword may contain several tokens.",
		"anyCollocate": "Any token in the selected context may be counted as a collocate.",
		"collocates": "Collocates",
		"keywordPattern": "Keyword pattern (BCQL)",
		"keywordPatternHelp": "The word or pattern for which to find collocates.",
		"collocatePattern": "Collocate filter (BCQL)",
		"context": "Context window",
		"before": "Tokens before",
		"after": "Tokens after",
		"contextRequired": "The context must include at least one token before or after the keyword.",
		"within": "Within element",
		"annotation": "Collocate annotation",
		"scorer": "Score",
		"scorers": {
			"dice": "Dice coefficient",
			"salience": "Salience"
		},
		"sensitive": "Case- and accent-sensitive grouping",
		"results": {
			"collocate": "Collocate",
			"associationShort": "Association",
			"association": "Association ({scorer})",
			"cooccurrences": "Co-occurrences",
			"documents": "Documents",
			"totalCollocates": "Total collocates",
			"columnMeanings": "Column meanings",
			"help": {
				"collocate": "The word or annotation value found near the keyword.",
				"association": "The association strength calculated with {scorer}. Sort by this score to explore association, or by co-occurrences to find frequent combinations. Check the counts and contexts alongside the score.",
				"cooccurrences": "The number of times this collocate occurs in the selected context window.",
				"documents": "The number of documents containing these co-occurrences. A large count in few documents may reflect repetition in a small number of sources."
			},
			"backToCollocations": "Back to collocations",
			"openAllContexts": "Open all contexts"
		}
	},
	"partOfSpeech": {
		"noOptions": "No options",
		"submit": "Ok",
		"reset": "Reset",
		"cancel": "Cancel",
		"noneSelected": "No options selected",
		"edit": "Edit Part of Speech selection"
	},
	"lexicon": {
		"selectAll": "Select all",
		"deselectAll": "Deselect all",
		"limit": "Limit to Part of Speech"
	},
	"filterOverview": {
		"error": "Error",
		"subCorpus": "Selected subcorpus",
		"totalDocuments": "Total documents",
		"totalTokens": "Total tokens",
		"calculating": "Calculating size of selected subcorpus..."
	},
	"annotation": {
		"caseSensitive": "Case- and diacritics-sensitive"
	},
	"results": {
		"groupBy": {
			"groupNameWithoutValue": "[no value]",

			"groupResults": "Group Results",
			"close": "Close",
			"clear": "Clear",
			"apply": "Group",

			"parallelCorpusVersion": "Looking at version ",
			"iWantToGroupOnAnnotation": "I want to group on {some_words} {in_this_location_with_text} using annotation {this_annotation}.",
			"in_this_location_with_text": "{in_this_location}",

			"some_words": {
				"theFirstWord": "the first word",
				"allWords": "all words",
				"specificWords": "specific words",
				"captureGroupsLabel": "Labels and relations"
			},
			"in_this_location": {
				"beforeTheHit": "before the hit",
				"inTheHit": "within the hit",
				"afterTheHit": "after the hit",
				"fromTheEnd": "from the end of the hit"
			},

			"relationPart": {
				"label": "Relation part",
				"source": "source",
				"target": "target"
			},

			"tipClickOnHighlightedWords": "Tip: click on highlighted words for syntactic grouping.",

			"caseSensitive": "Case sensitive",
			"chooseWordPositions": "Choose the <strong>specific word</strong> positions to group on here, the preview sentence will show you which words you have selected.",
			"selectDocumentMetadata": "Select the metadata to group on.",
			"clickButtonsToStart": "Click on Annotation or Metadata to define grouping criteria.",
			"metadata": "Metadata",
			"annotation": "Annotation",
			"specify": "Specify",

			"summary": {
				"indexedWord": "{field} [{index}] {position}",
				"firstWord": "first {field} {position}",
				"allWords": "{field} {position}",
				"labelledWord": "label {label} on {field}",
				"metadata": "Document {field}",

				"position": {
					"before": "before hit",
					"hit": "within hit",
					"after": "after hit",
					"end": "within hit"
				}
			}
		},
		"table": {
			"dependencySet": "Dependency set",
			"showFullSentence": "Display sentence analysis",
			"loading": "Loading...",
			"loadMoreConcordances": "Load more concordances",
			"viewDetailedConcordances": "View detailed concordances",
			"document": "Document",
			"hits": "Hits",
			"columnLabelBeforeHit": "Before Hit",
			"columnLabelHit": "Hit",
			"columnLabelAfterHit": "After Hit",
			"sortBy": "Sort by {field}",
			"sortByDescending": "Sort by {field} (reverse)",
			"sortedAscending": "Sorted ascending",
			"sortedDescending": "Sorted descending",
			"sort_numberOfHits": "number of hits",
			"sort_groupName": "group name",
			"sort_groupSize": "group size",
			"sort_alignments": "alignments",
			"groupBy": "Group by {field}",
			"sortByDocument": "Sort by document title",
			"moreHiddenHits": "{count} more hidden hits",
			"close": "close",
			"hide": "Hide",
			"show": "Show",
			"titles": "Titles",
			"property": "Property",
			"value": "value",
			"noContext": "No context available.",
			"customColumnHeader": "Version",
			"goToHitInDocument": "Go to hit in document",
			"expandTruncatedSnippetButtonLabel": "[more]",
			"collapseTruncatedSnippetButtonLabel": "[less]"
		},
		"export": {
			"downloading": "Downloading...",
			"csvTooltip": "Export results as a CSV file",
			"excelTooltip": "Export Results as a CSV file for use with Excel",
			"exportCSV": "Export",
			"exportExcel": "Export for Excel"
		},
		"querySummary": {
			"heading": "Results for: ",
			"allDocuments": "all documents",
			"within": "within",
			"documentsWhere": "documents where"
		},
		"resultsView": {
			"navigation": {
				"backToGroupedResults": "Go back to grouped results",
				"backToUngroupedResults": "Go vack to ungrouped results",
				"hits": "Hits",
				"documents": "Documents",
				"viewingGroup": "Viewing group {group}",
				"groupedBy": "Grouped by {group}",
				"sortedBy": "Sorted by {sort}",
				"randomSample": "Random sample ({sample})"
			},

			"noResultsFound": "No results found.",
			"inactiveView": "This view is inactive because no search criteria for words were specified.",
			"tryAgainTitle": "Try again with current search settings",
			"tryAgain": "Try again",
			"selectAnnotation": "Select annotation"
		},
		"resultsTotals": {
			"total": "Total",
			"soFar": "so far",
			"totalGroups": "Total groups",
			"searchTime": "Search time",
			"networkError": "Network error",
			"retry": "Retry",
			"queryLimited": "Query limited",
			"heavyQuery": "Heavy query",
			"continue": "Continue",
			"hits": "hits",
			"documents": "documents",
			"tokens": "tokens"
		},
		"sort": {
			"sortBy": "Sort by…",
			"groups": "Groups",
			"parallelCorpus": "Parallel Corpus",
			"documents": "Documents"
		},
		"shared": {
			"spanAttribute": "tag {span}, attribute {attribute}"
		}
	},
	"article": {
		"statistics": {
			"notConfigured": "No statistics have been configured for this corpus."
		}
	},
	"history": {
		"heading": "History",
		"results": "Results",
		"pattern": "Pattern",
		"filters": "Filters",
		"grouping": "Grouping",
		"search": "Search",
		"copyAsLink": "Copy as link",
		"downloadAsFile": "Download as file",
		"delete": "Delete",
		"deleteAll": "Delete all",
		"loadMore": "Load more",
		"importUrl": "Import url",
		"copyUrlHere": "Copy your url here",
		"importFromLink": "Import from a link",
		"close": "Close",
		"clearSearchHistory": "Clear search history",
		"clearSearchHistoryConfirmation": "Are you sure you want to clear your search history?",
		"clear": "Clear",
		"cancel": "Cancel"
	},
	"remoteIndex": {
		"loadingCorpora": "Loading your corpora...",
		"configure": "Configure",
		"retry": "Retry"
	},
	"index": {
		"relations": {
			"dep": {
				"source": "head",
				"target": "dependent"
			}
		},
		"annotatedFields": {
			"$exampleAnnotatedField": "Translated display name for annotated field $exampleAnnotatedField",
			"$exampleAnnotatedField_description": "Translated description for annotated field $exampleAnnotatedField"
		},
		"annotations": {
			"$exampleAnnotation": "Translated display name for annotation $exampleAnnotation",
			"$exampleAnnotation_description": "Translated description for annotation $exampleAnnotation"
		},
		"annotationGroups": {
			"$exampleAnnotationGroup": "Translated display name for annotation group $exampleAnnotationGroup"
		},
		"metadata": {
			"$exampleMetadataField": "Translated display name for metadata field $exampleMetadataField"
		},
		"metadataGroups": {
			"$exampleMetadataGroup": "Translated display name for metadata group $exampleMetadataGroup"
		},
		"spans": {
			"$exampleSpanValue": "Translated display name for span $exampleSpanValue"
		},
		"spanAttributes": {
			"$exampleSpanValue": {
				"$exampleSpanAttribute": "Translated display name for span attribute $exampleSpanAttribute of span $exampleSpanValue"
			}
		},
		"alignBy": {
			"$exampleAlignByValue": "Translated display name for align by relation $exampleAlignByValue"
		}
	}
}

Creating a translation ​

Create a new file in static directory of your corpus' interface data directory (corporaInterfaceDataDir), e.g., static/locales/fr.json. It's best to copy an existing locale file and translate the strings.

Global translations ​

Place your locales in the default directory of the interface data directory (corporaInterfaceDataDir) to make them available for all corpora at once.
This uses the overlay system to apply translations globally.

You can even override these defaults further by placing additional locale files in the static directory of your corpus' dedicated static directory.

Comments ​

Locale files can contain comments using // comment or /* comment */.

Add or remove a language from the selector ​

We don't automatically detect and add locales to the language selector, so you need to register them manually.

The locale string should match the filename of your added locale.

ts
function i18n.registerLocale(locale: string, label: string);
function i18n.removeLocale(locale: string);

Set the default locale ​

Used when no language is selected or the browser's locale isn't available.
The default is en-us.

ts
function i18n.setDefaultLocale(locale: string);

Set the fallback for untranslated keys ​

Defaults to en-us, but you can change it to any other locale you have registered.
⚠️ Make sure to register the locale first, otherwise this won't have any effect.

ts
function i18n.setFallbackLocale(locale: string);

Customize parallel version display names ​

If you have a parallel corpus of book translations with e.g. en, de and fr versions, custome the field display names under index.annotatedFields.

Parallel i18n in more detail
json
{
	"search": {
		"parallel": {
			"searchSourceVersion": "Search language",
			"errorNoSourceVersion": "Please select a language.",
			"andCompareWithTargetVersions": "and compare with language(s)",
			"queryForSourceVersion": "Source language",
			"queryForTargetVersion": "Target language"
		}
	},

	"index": {
		"annotatedFields": {
			"contents__en": "English",
			"contents__de": "German",
			"contents__fr": "French"
		},

		"annotationGroups": {
			"Other": ""
		},

		"metadataGroups": {
			"Metadata": ""
		},

		"alignBy": {
			"word-alignment": "Word",
			"sentence-alignment": "Sentence"
		},

		"spans": {
			"s": "Sentence"
		},

		"spanAttributes": {
			"div": {
				"chapter": "chapter"
			}
		},

		"metadata": {
			"bookName": "Book name",

			"spanFilters": {
				"div": {
					"chapter": "Chapter"
				}
			}
		}
	},

	"results": {
		"groupBy": {
			"some_words": {
				"spanFiltersLabel": ""
			},
			"groupLabel": {
				"tag div": ""
			}
		}
	}
}

Technical details ​

The app uses vue-i18n. Not all UI text is translatable yet; contributions are welcome.

To help add translation keys, look for usages like {{ $t('search.simple.heading') }} in the code.

To add a new language, copy an existing file in src/frontend/src/locales, rename it for your locale (e.g., fr.json), and translate the strings.

Translating annotations, metadata, etc. ​

In your override file in static/locales, you can set names for annotations, metadata fields, and more. For example, in $corporaInterfaceDataDir/YOUR_CORPUS/static/locales/en-us.json:

json
{
  "index": {
    "annotations": {
      "pos": "Part of speech"
    },
    "annotationGroups": {
      "simple": "Basic annotations",
      "advanced": "Advanced annotations"
    },
    "metadata": {
      "spanFilters": {
        "name": {
          "type": "Named entity type"
        }
      }
    },
    "metadataGroups": {
      "author": "Author-related fields",
      "date": "Date-related fields"
    },
    "within": {
      "name": "Named entity"
    }
  }
}

Apache license 2.0