Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for the bug where the default language in global settings cannot be changed #350

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

omochi
Copy link

@omochi omochi commented Oct 25, 2024

The test code resulted in the following error.

  1) i18n
       fontkit.setDefaultLanguage
         can set global default language to "ar":

      AssertionError [ERR_ASSERTION]: 'en' == 'ar'
      + expected - actual

      -en
      +ar
      
      at Context.<anonymous> (file:///Users/omochi/temp/fontkit/test/i18n.js:30:14)
      at process.processImmediate (node:internal/timers:483:21)

This patch fix the issue.

Bug detail

In base.js, a string value is being exported as let defaultLanguage, but since exported members are copied when imported, calling setDefaultLanguage afterwards does not reflect the change.

Fix

I will change defaultLanguage from a value to a getter function.

Environment

macOS Sequoia 15.1 Beta 24B5046f
nodejs v22.5.1

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.

1 participant