Skip to content

Commit

Permalink
align method signature
Browse files Browse the repository at this point in the history
  • Loading branch information
Tcharl committed Oct 10, 2024
1 parent 9fd9ca2 commit 9ed2529
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
16 changes: 8 additions & 8 deletions generators/angular/support/translate-angular.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export type ReplacerOptions = { jhiPrefix: string; enableTranslation: boolean };
* @returns {string}
*/
function replaceTranslationKeysWithText(
getWebappTranslation: (key: string, val?: Record<string, any> | undefined) => string,
getWebappTranslation: (s: string, val?: Record<string, any> | undefined) => string,
content: string,
regexSource: string,
{
Expand Down Expand Up @@ -79,7 +79,7 @@ function replaceTranslationKeysWithText(
* @returns string with jsKey value replaced
*/
function replaceJSTranslation(
getWebappTranslation: (key: string, val?: Record<string, any> | undefined) => string,
getWebappTranslation: (s: string, val?: Record<string, any> | undefined) => string,
content: string,
jsKey: string,
) {
Expand All @@ -99,14 +99,14 @@ function replaceJSTranslation(
* @param {string} content html content
* @returns string with pageTitle replaced
*/
function replacePageTitles(getWebappTranslation: (key: string, val?: Record<string, any> | undefined) => string, content: string) {
function replacePageTitles(getWebappTranslation: (s: string, val?: Record<string, any> | undefined) => string, content: string) {
return replaceJSTranslation(getWebappTranslation, content, 'title');
}

/**
* @type {function(import('../generator-base.js'), string): string}
*/
function replacePlaceholders(getWebappTranslation: (key: string, val?: Record<string, any> | undefined) => string, content: string) {
function replacePlaceholders(getWebappTranslation: (s: string, val?: Record<string, any> | undefined) => string, content: string) {
return replaceTranslationKeysWithText(getWebappTranslation, content, PLACEHOLDER_REGEX, { keyIndex: 2 });
}

Expand All @@ -115,7 +115,7 @@ function replacePlaceholders(getWebappTranslation: (key: string, val?: Record<st
*
* @type {function(import('../generator-base.js'), string): string}
*/
function replaceErrorMessage(getWebappTranslation: (key: string, val?: Record<string, any> | undefined) => string, content: string) {
function replaceErrorMessage(getWebappTranslation: (s: string, val?: Record<string, any> | undefined) => string, content: string) {
return replaceJSTranslation(getWebappTranslation, content, 'errorMessage');
}

Expand All @@ -124,7 +124,7 @@ function replaceErrorMessage(getWebappTranslation: (key: string, val?: Record<st
* Or the translation value if translation is disabled.
*/
const tagTranslation = (
getWebappTranslation: (key: string, val?: Record<string, any> | undefined) => string,
getWebappTranslation: (s: string, val?: Record<string, any> | undefined) => string,
{ enableTranslation, jhiPrefix }: ReplacerOptions,
{ key, parsedInterpolate, prefix, suffix }: JHITranslateConverterOptions,
) => {
Expand Down Expand Up @@ -297,7 +297,7 @@ const replaceImplementations: Record<
* @this {import('../generator-base.js')}
*/
export const createTranslationReplacer = (
getWebappTranslation: (key: string, val?: Record<string, any> | undefined) => string,
getWebappTranslation: (s: string, val?: Record<string, any>) => string,
opts: ReplacerOptions | boolean,
) => {
const htmlJhiTranslateReplacer = createJhiTransformTranslateReplacer(getWebappTranslation, { escapeHtml: true });
Expand Down Expand Up @@ -348,7 +348,7 @@ const minimatch = new Minimatch('**/*{.html,.ts}');
export const isTranslatedAngularFile = file => minimatch.match(file.path);

export const translateAngularFilesTransform = (
getWebappTranslation: (key: string, val?: Record<string, any> | undefined) => string,
getWebappTranslation: (s: string, val?: Record<string, any>) => string,
opts: ReplacerOptions | boolean,
) => {
const translate = createTranslationReplacer(getWebappTranslation, opts);
Expand Down
1 change: 1 addition & 0 deletions generators/client/support/template-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import path from 'path';

import { clientFrameworkTypes, fieldTypes } from '../../../lib/jhipster/index.js';
import type { PrimaryKey } from '../../../lib/types/application/entity.js';
import type { FieldType } from '../../../lib/application/field-types.js';
import type { Field } from '../../../lib/types/application/index.js';
import { getEntryIfTypeOrTypeAttribute } from './types-utils.js';

Expand Down

0 comments on commit 9ed2529

Please sign in to comment.