-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #29742 from software-mansion-labs/ts-migration/loc…
…alize-lib [TS migration] Migrate 'Localize' lib to TypeScript
- Loading branch information
Showing
13 changed files
with
113 additions
and
97 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import ELECTRON_EVENTS from '../../../../desktop/ELECTRON_EVENTS'; | ||
import BaseLocaleListener from './BaseLocaleListener'; | ||
import {LocaleListener, LocaleListenerConnect} from './types'; | ||
|
||
const localeListenerConnect: LocaleListenerConnect = (callbackAfterChange = () => {}) => | ||
BaseLocaleListener.connect((val) => { | ||
// Send the updated locale to the Electron main process | ||
window.electron.send(ELECTRON_EVENTS.LOCALE_UPDATED, val); | ||
|
||
// Then execute the callback provided for the renderer process | ||
callbackAfterChange(val); | ||
}); | ||
|
||
const localeListener: LocaleListener = { | ||
connect: localeListenerConnect, | ||
}; | ||
|
||
export default localeListener; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import BaseLocaleListener from './BaseLocaleListener'; | ||
import {LocaleListener, LocaleListenerConnect} from './types'; | ||
|
||
const localeListenerConnect: LocaleListenerConnect = BaseLocaleListener.connect; | ||
|
||
const localizeListener: LocaleListener = { | ||
connect: localeListenerConnect, | ||
}; | ||
|
||
export default localizeListener; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import {ValueOf} from 'type-fest'; | ||
import CONST from '@src/CONST'; | ||
|
||
type BaseLocale = ValueOf<typeof CONST.LOCALES>; | ||
|
||
type LocaleListenerConnect = (callbackAfterChange?: (locale?: BaseLocale) => void) => void; | ||
|
||
type LocaleListener = { | ||
connect: LocaleListenerConnect; | ||
}; | ||
|
||
export type {LocaleListenerConnect, LocaleListener}; | ||
export default BaseLocale; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters