Skip to content

Commit 61a24a0

Browse files
committed
Update log messages to use translations
1 parent a345741 commit 61a24a0

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+516
-277
lines changed

.vscode/settings.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
"mochaExplorer.configFile": ".config/mocha.test-explorer.json",
4242
"cSpell.words": [
4343
"cname",
44+
"Combinatorially",
4445
"deserializers",
4546
"githubprivate",
4647
"linkcode",

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
# Beta
2+
3+
## Breaking Changes
4+
5+
- Removed deprecated `navigation.fullTree` option.
6+
17
# Unreleased
28

39
## Features

src/lib/application.ts

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,10 @@ import { findTsConfigFile } from "./utils/tsconfig";
4242
import { deriveRootDir, glob, readFile } from "./utils/fs";
4343
import { resetReflectionID } from "./models/reflections/abstract";
4444
import { addInferredDeclarationMapPaths } from "./models/reflections/ReflectionSymbolId";
45-
import { Internationalization } from "./internationalization/internationalization";
45+
import {
46+
Internationalization,
47+
TranslatedString,
48+
} from "./internationalization/internationalization";
4649

4750
// eslint-disable-next-line @typescript-eslint/no-var-requires
4851
const packageInfo = require("../../package.json") as {
@@ -175,6 +178,7 @@ export class Application extends ChildableComponent<
175178

176179
this.converter = this.addComponent<Converter>("converter", Converter);
177180
this.renderer = this.addComponent<Renderer>("renderer", Renderer);
181+
this.logger.i18n = this.i18n;
178182
}
179183

180184
/**
@@ -235,19 +239,20 @@ export class Application extends ChildableComponent<
235239
}
236240
this.trigger(ApplicationEvents.BOOTSTRAP_END, this);
237241

242+
// GERRIT: Add locales to i18n here.
238243
if (!this.internationalization.hasTranslations(this.lang)) {
239244
// Not internationalized as by definition we don't know what to include here.
240245
this.logger.warn(
241-
`Options specified "${this.lang}" as the language to use, but TypeDoc does not support it.`,
246+
`Options specified "${this.lang}" as the language to use, but TypeDoc does not support it.` as TranslatedString,
242247
);
243248
this.logger.info(
244-
"The supported languages are:\n\t" +
249+
("The supported languages are:\n\t" +
245250
this.internationalization
246251
.getSupportedLanguages()
247-
.join("\n\t"),
252+
.join("\n\t")) as TranslatedString,
248253
);
249254
this.logger.info(
250-
"You can define/override local locales with the `locales` option, or contribute them to TypeDoc!",
255+
"You can define/override local locales with the `locales` option, or contribute them to TypeDoc!" as TranslatedString,
251256
);
252257
}
253258
}
@@ -259,7 +264,7 @@ export class Application extends ChildableComponent<
259264
} catch (error) {
260265
ok(error instanceof Error);
261266
if (reportErrors) {
262-
this.logger.error(error.message);
267+
this.logger.error(error.message as TranslatedString); // GERRIT review
263268
}
264269
}
265270
}
@@ -433,7 +438,7 @@ export class Application extends ChildableComponent<
433438
ts.flattenDiagnosticMessageText(
434439
status.messageText,
435440
newLine,
436-
),
441+
) as TranslatedString,
437442
);
438443
},
439444
);

src/lib/converter/comments/discovery.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,9 @@ export function discoverComment(
201201
return discovered[0];
202202
default: {
203203
logger.warn(
204-
`${symbol.name} has multiple declarations with a comment. An arbitrary comment will be used.`,
204+
logger.i18n.symbol_0_has_multiple_declarations_with_comment(
205+
symbol.name,
206+
),
205207
);
206208
const locations = discovered.map(({ file, ranges: [{ pos }] }) => {
207209
const path = nicePath(file.fileName);
@@ -210,9 +212,10 @@ export function discoverComment(
210212
return `${path}:${line}`;
211213
});
212214
logger.info(
213-
`The comments for ${
214-
symbol.name
215-
} are declared at:\n\t${locations.join("\n\t")}`,
215+
logger.i18n.comments_for_0_are_declared_at_1(
216+
symbol.name,
217+
locations.join("\n\t"),
218+
),
216219
);
217220
return discovered[0];
218221
}

src/lib/converter/comments/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,7 @@ export function getJsDocComment(
279279
// we'd have to search for any @template with a name starting with the first type parameter's name
280280
// which feels horribly hacky.
281281
logger.warn(
282-
`TypeDoc does not support multiple type parameters defined in a single @template tag with a comment.`,
282+
logger.i18n.multiple_type_parameters_on_template_tag_unsupported(),
283283
declaration,
284284
);
285285
return;
@@ -301,7 +301,7 @@ export function getJsDocComment(
301301

302302
if (!tag) {
303303
logger.error(
304-
`Failed to find JSDoc tag for ${name} after parsing comment, please file a bug report.`,
304+
logger.i18n.failed_to_find_jsdoc_tag_for_name_0(name),
305305
declaration,
306306
);
307307
} else {

0 commit comments

Comments
 (0)