Skip to content

Migrate to the vue-i18n composition API#9375

Merged
FreeTubeBot merged 1 commit into
FreeTubeApp:developmentfrom
absidue:vue-i18n-composition
Jul 6, 2026
Merged

Migrate to the vue-i18n composition API#9375
FreeTubeBot merged 1 commit into
FreeTubeApp:developmentfrom
absidue:vue-i18n-composition

Conversation

@absidue

@absidue absidue commented Jul 5, 2026

Copy link
Copy Markdown
Member

Pull Request Type

  • Other

Description

vue-i18n has been logging a warning to the console for a while now saying that the legacy API is deprecated and will be removed in vue-i18n v12 and that we should migrate to the vue-i18n composition API. As we've been migrating components to the composition API one by one, we were using the legacy API plus a custom useI18n composable polyfill, with a custom ESLint rule to enforce the usage of the polyfill.

This pull request migrates to the vue-i18n composition API, removing the custom polyfill and ESLint rule. In most places it was just a case of swapping the useI18n import to vue-i18n. The locale and messages properties on the global instance changed from reactive properties to a WriteableComputedRef and a ComputedRef respectively so I had to add .value for those. In the two remaining components using the Vue options API, Watch and ft-list-video, I added the setup lifecyle hook which calls useI18n and returns the translation function and locale (I did try to return the translation function as $t instead of t but Vue logged a warning about dollar and underscore prefixed properties being reserved for app level injected properties).

I was originally going to wait until all components had been migrated to the Vue composition API but as there are open pull requests that touch the ft-list-video and Watch components, I decided not to wait (I also wanted to cross this item off my todo list :P ). The changes in this pull request shouldn't cause any conflicts, at least from my quick skimming over the lines that the other open pull requests touch.

Running pnpm run pack:renderer before and after the change showed the dist/renderer.js file being 4114 bytes smaller.

Testing

Try changing the locale and make sure the display strings change to match the chosen locale.

Desktop

  • OS: Windows
  • OS Version: 11

@FreeTubeBot FreeTubeBot enabled auto-merge (squash) July 5, 2026 15:23
@github-actions github-actions Bot added the PR: waiting for review For PRs that are complete, tested, and ready for review label Jul 5, 2026
@FreeTubeBot FreeTubeBot merged commit 8bf990d into FreeTubeApp:development Jul 6, 2026
6 checks passed
@github-actions github-actions Bot removed the PR: waiting for review For PRs that are complete, tested, and ready for review label Jul 6, 2026
PikachuEXE added a commit to PikachuEXE/FreeTube that referenced this pull request Jul 6, 2026
* development: (24 commits)
  Add dependabot groups for actions/cache and github/codeql-action (FreeTubeApp#9373)
  Handle compact published dates e.g. 1w ago in LockupViews (FreeTubeApp#9374)
  Migrate to the vue-i18n composition API (FreeTubeApp#9375)
  Bump electron from 42.4.1 to 42.5.2 (FreeTubeApp#9362)
  Bump eslint-plugin-unicorn from 69.0.0 to 70.0.0 in the eslint group (FreeTubeApp#9367)
  Bump actions/cache/restore from 6.0.0 to 6.1.0 (FreeTubeApp#9366)
  Bump actions/cache/save from 6.0.0 to 6.1.0 (FreeTubeApp#9365)
  Bump js-yaml from 5.2.0 to 5.2.1 (FreeTubeApp#9369)
  Fix lazy rendering on channel home pages (FreeTubeApp#9336)
  Fix publish time parsing (FreeTubeApp#9310)
  Fix online playlist parsing & revert workaround with youtubei.js update (FreeTubeApp#9325)
  Fix parsing view counts in shorts-only playlists (FreeTubeApp#9333)
  Build static runtime AppImages with electron-builder (FreeTubeApp#9339)
  use new matrix icon (FreeTubeApp#9359)
  Translated using Weblate (Polish)
  Bump the webpack group across 1 directory with 2 updates (FreeTubeApp#9347)
  Bump the stylelint group across 1 directory with 3 updates (FreeTubeApp#9345)
  Bump vue from 3.5.38 to 3.5.39 (FreeTubeApp#9353)
  Bump js-yaml from 4.2.0 to 5.2.0 (FreeTubeApp#9348)
  Bump globals from 17.6.0 to 17.7.0 (FreeTubeApp#9350)
  ...

# Conflicts:
#	src/renderer/components/GeneralSettings/GeneralSettings.vue
@absidue absidue deleted the vue-i18n-composition branch July 6, 2026 04:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants