Skip to content

Commit

Permalink
refactor(lang): use lang list of library
Browse files Browse the repository at this point in the history
  • Loading branch information
eythaann committed Jan 19, 2025
1 parent d71225c commit 44e9a48
Show file tree
Hide file tree
Showing 15 changed files with 24 additions and 104 deletions.
9 changes: 4 additions & 5 deletions scripts/bundle.msix.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ async function getArgs() {
};
}

const [major, minor, patch, nightly_date = 0] = packageJson.version.split(/[\.\+]/);
const [major, minor, patch, _nightly_date = 0] = packageJson.version.split(/[\.\+]/);
if (major === undefined || minor === undefined || patch === undefined) {
throw new Error('Invalid package version');
}
Expand All @@ -35,16 +35,15 @@ fs.mkdirSync(buildFolder, { recursive: true });
fs.mkdirSync(bundleFolder, { recursive: true });

// we skip revision here because greater numbers than 65535 are not supported on msix
const packageVersion = `${major}.${minor}.${patch}.0`;
const postfix = nightly_date ? `+${nightly_date}` : '';
const appxPackageVersion = `${major}.${minor}.${patch}.0`;
const installer_msix_path = path.resolve(
`${bundleFolder}/Seelen.SeelenUI_${packageVersion}${postfix}_x64__p6yyn03m1894e.msix`,
`${bundleFolder}/Seelen.SeelenUI_${packageJson.version}_x64__p6yyn03m1894e.msix`,
);

// Add manifest
const manifest = fs
.readFileSync('templates/AppxManifest.xml', 'utf-8')
.replace('{{version}}', packageVersion);
.replace('{{version}}', appxPackageVersion);
fs.writeFileSync(`${buildFolder}/AppxManifest.xml`, manifest);

// Add binaries
Expand Down
3 changes: 1 addition & 2 deletions scripts/translate.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import { SupportedLanguages } from '@seelen-ui/lib';
import { existsSync, readFileSync, writeFileSync } from 'fs';
import { translate } from 'google-translate-api-x';
import yaml from 'js-yaml';
import yargs from 'yargs';
import { hideBin } from 'yargs/helpers';

import { SupportedLanguages } from '../src/apps/shared/lang';

const argv = await yargs(hideBin(process.argv))
.option('delete', {
type: 'array',
Expand Down
3 changes: 1 addition & 2 deletions src/apps/seelen_rofi/i18n/index.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import { SupportedLanguagesCode } from '@seelen-ui/lib';
import i18n from 'i18next';
import yaml from 'js-yaml';
import { initReactI18next } from 'react-i18next';

import { SupportedLanguagesCode } from '../../shared/lang';

i18n.use(initReactI18next).init(
{
lng: 'en',
Expand Down
3 changes: 1 addition & 2 deletions src/apps/seelenweg/i18n/index.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import { SupportedLanguagesCode } from '@seelen-ui/lib';
import i18n from 'i18next';
import yaml from 'js-yaml';
import { initReactI18next } from 'react-i18next';

import { SupportedLanguagesCode } from '../../shared/lang';

i18n.use(initReactI18next).init(
{
lng: 'en',
Expand Down
3 changes: 1 addition & 2 deletions src/apps/settings/i18n/index.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import { SupportedLanguagesCode } from '@seelen-ui/lib';
import i18n from 'i18next';
import yaml from 'js-yaml';
import { initReactI18next } from 'react-i18next';

import { SupportedLanguagesCode } from '../../shared/lang';

i18n.use(initReactI18next).init(
{
lng: 'en',
Expand Down
2 changes: 1 addition & 1 deletion src/apps/settings/modules/general/main/infra/index.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { SupportedLanguages } from '@seelen-ui/lib';
import { Input, Select, Switch, Tooltip } from 'antd';
import { ChangeEvent, useState } from 'react';
import { useTranslation } from 'react-i18next';
Expand All @@ -10,7 +11,6 @@ import { RootActions } from '../../../shared/store/app/reducer';
import { RootSelectors } from '../../../shared/store/app/selectors';
import { Icon } from 'src/apps/shared/components/Icon';

import { SupportedLanguages } from '../../../../../shared/lang';
import { SettingsGroup, SettingsOption } from '../../../../components/SettingsBox';
import { Colors } from './Colors';
import { IconPacks } from './IconPacks';
Expand Down
13 changes: 9 additions & 4 deletions src/apps/shared/index.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,20 @@
import { getRootElement, SeelenCommand } from '@seelen-ui/lib';
import { SeelenCommand } from '@seelen-ui/lib';
import { invoke } from '@tauri-apps/api/core';

export const getRootContainer = getRootElement;
export function getRootContainer(): HTMLElement {
const element = document.getElementById('root');
if (!element) {
throw new Error('Root element not found');
}
return element;
}

export function toPhysicalPixels(size: number): number {
return Math.round(size * window.devicePixelRatio);
}

export async function wasInstalledUsingMSIX(): Promise<boolean> {
// Todo replace this when added to SeelenCommand
return invoke('is_appx_package');
return invoke(SeelenCommand.IsAppxPackage);
}

export async function isDev(): Promise<boolean> {
Expand Down
83 changes: 0 additions & 83 deletions src/apps/shared/lang.ts

This file was deleted.

3 changes: 1 addition & 2 deletions src/apps/toolbar/i18n/index.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import 'moment/min/locales';
import { SupportedLanguagesCode } from '@seelen-ui/lib';
import i18n from 'i18next';
import yaml from 'js-yaml';
import { initReactI18next } from 'react-i18next';

import { SupportedLanguagesCode } from '../../shared/lang';

i18n.use(initReactI18next).init(
{
lng: 'en',
Expand Down
1 change: 0 additions & 1 deletion static/widgets/demo.yml

This file was deleted.

1 change: 1 addition & 0 deletions static/widgets/launcher.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
id: '@seelen/launcher'
1 change: 1 addition & 0 deletions static/widgets/toolbar.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
id: '@seelen/fancy-toolbar'
1 change: 1 addition & 0 deletions static/widgets/wallpaper-manager.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
id: '@seelen/wallpaper-manager'
1 change: 1 addition & 0 deletions static/widgets/weg.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
id: '@seelen/weg'
1 change: 1 addition & 0 deletions static/widgets/window-manager.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
id: '@seelen/window-manager'

0 comments on commit 44e9a48

Please sign in to comment.