Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion examples/ssr/vite/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ async function createServer(
}

if (!isTest) {
createServer().then(({ app }) =>
createServer().then(({ app, vite }) =>
app.listen(3000, () => {
console.log('http://localhost:3000')
})
Expand Down
6 changes: 3 additions & 3 deletions packages/vue-i18n-core/src/composer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1914,7 +1914,7 @@ export function createComposer(options: any = {}, VueI18nLegacy?: any): any {
// eslint-disable-next-line prefer-const
let _context: CoreContext

function getCoreContext(): CoreContext {
const getCoreContext = (): CoreContext => {
_isGlobal && setFallbackContext(null)

const ctxOptions = {
Expand Down Expand Up @@ -2052,14 +2052,14 @@ export function createComposer(options: any = {}, VueI18nLegacy?: any): any {
return type !== 'translate' || !arg.resolvedMessage
}

function wrapWithDeps<T, U = T>(
const wrapWithDeps = <T, U = T>(
fn: (context: unknown) => unknown,
argumentParser: () => unknown[],
warnType: ComposerWarnType,
fallbackSuccess: (root: Composer<T> & ComposerInternal) => U,
fallbackFail: (key: unknown) => U,
successCondition: (val: unknown) => boolean
): U {
): U => {
trackReactivityValues() // track reactive dependency
// NOTE: experimental !!
let ret: unknown
Expand Down
11 changes: 6 additions & 5 deletions packages/vue-i18n-core/src/directive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ function getComposer(
export type TranslationDirective<T = HTMLElement> = ObjectDirective<T>

export function vTDirective(i18n: I18n): TranslationDirective<HTMLElement> {
function process(binding: DirectiveBinding): [string, Composer] {
const process = (binding: DirectiveBinding): [string, Composer] => {
const { instance, modifiers, value } = binding
/* istanbul ignore if */
if (!instance || !instance.$) {
Expand Down Expand Up @@ -140,15 +140,16 @@ export function vTDirective(i18n: I18n): TranslationDirective<HTMLElement> {
])
}
}
const getSSRProps = (binding: DirectiveBinding) => {
const [textContent] = process(binding)
return { textContent }
}

return {
created: register,
unmounted: unregister,
beforeUpdate: update,
getSSRProps: (binding: DirectiveBinding) => {
const [textContent] = process(binding)
return { textContent }
}
getSSRProps
} as TranslationDirective<HTMLElement>
}

Expand Down