Skip to content

Commit

Permalink
refactor: Moar LangString
Browse files Browse the repository at this point in the history
  • Loading branch information
arildm committed Jul 5, 2024
1 parent 22eb9a4 commit 741a8b5
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions app/scripts/components/corpus-updates.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import angular, { IScope } from "angular"
import moment from "moment"
import settings from "@/settings"
import { html } from "@/util"
import { LangMap } from "@/i18n/types"
import { LangString } from "@/i18n/types"

export default angular.module("korpApp").component("corpusUpdates", {
template: html`
Expand Down Expand Up @@ -75,5 +75,5 @@ type CorpusUpdatesScope = IScope & {

type Corpus = {
info: { Updated: string }
title: LangMap | string
title: LangString
}
4 changes: 2 additions & 2 deletions app/scripts/i18n/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import isObject from "lodash/isObject"
import settings from "@/settings"
import { getService } from "@/util"
import type { LangLocMap, LangMap, LocLangMap, LocMap } from "@/i18n/types"
import type { LangLocMap, LangString, LocLangMap, LocMap } from "@/i18n/types"

/** Get the current UI language. */
export function getLang(): string {
Expand Down Expand Up @@ -30,7 +30,7 @@ export function loc(key: string, lang?: string) {
* @param lang The code of the language to translate to. Defaults to the global current language.
* @returns The translated string, or undefined if no translation is found.
*/
export function locObj(map: LangMap | string, lang?: string): string | undefined {
export function locObj(map: LangString, lang?: string): string | undefined {
if (!map) return undefined
if (typeof map == "string") return map

Expand Down
4 changes: 2 additions & 2 deletions app/scripts/kwic_download.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import moment from "moment"
import CSV from "comma-separated-values/csv"
import { locObj } from "@/i18n"
import { type ApiKwic, type KorpQueryParams } from "@/backend/kwic-proxy"
import { LangMap } from "./i18n/types"
import { LangString } from "./i18n/types"

// This is what is returned by massageData in kwic.js
type Row = ApiKwic | LinkedKwic | CorpusHeading
Expand All @@ -18,7 +18,7 @@ type LinkedKwic = {
}

type CorpusHeading = {
newCorpus: LangMap | string
newCorpus: LangString
noContext?: boolean
}

Expand Down
2 changes: 1 addition & 1 deletion app/scripts/settings/config.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* @format
*/

import { Labeled, LangMap, LangString } from "@/i18n/types"
import { Labeled, LangString } from "@/i18n/types"

export type Config = {
attributes: {
Expand Down

0 comments on commit 741a8b5

Please sign in to comment.