Skip to content

Commit 637024d

Browse files
authored
1.6.0 (#27)
# Features * Added Russian, Spanish, Chinese, German and Hindi translations
1 parent e6ec5c5 commit 637024d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+969
-194
lines changed

Diff for: dist/_locales/de/messages.json

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"searchIn": {
3+
"message": "Suche in Netlogs"
4+
}
5+
}

Diff for: dist/_locales/en/messages.json

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"searchIn": {
3+
"message": "Search in Netlogs"
4+
}
5+
}

Diff for: dist/_locales/es/messages.json

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"searchIn": {
3+
"message": "Buscar en Netlogs"
4+
}
5+
}

Diff for: dist/_locales/hi/messages.json

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"searchIn": {
3+
"message": "Netlogs में खोजें"
4+
}
5+
}

Diff for: dist/_locales/ru/messages.json

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"searchIn": {
3+
"message": "Искать в Netlogs"
4+
}
5+
}

Diff for: dist/_locales/zh_CN/messages.json

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"searchIn": {
3+
"message": "在Netlogs中搜索"
4+
}
5+
}

Diff for: dist/manifest.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
"name": "Net logs",
3-
"version": "1.5.0",
3+
"version": "1.6.0",
4+
"default_locale": "en",
45
"manifest_version": 3,
56
"minimum_chrome_version": "88",
67
"description": "Extendable network logs debugger",

Diff for: package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "netlogs",
3-
"version": "1.5.0",
3+
"version": "1.6.0",
44
"description": "Web extension for custom network logs representation",
55
"main": "index.js",
66
"author": "artboomy",
@@ -23,6 +23,7 @@
2323
"base16": "1.0.0",
2424
"classnames": "2.2.6",
2525
"codemirror": "5.59.4",
26+
"i18n-js": "^4.4.3",
2627
"jszip": "^3.6.0",
2728
"lodash.clonedeep": "4.5.0",
2829
"lodash.isequal": "4.5.0",

Diff for: src/ThemeContainer.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import React, { FC, useMemo } from 'react';
22
import { ThemeProvider } from 'react-jss';
3-
import { useSettings } from './hooks/useSettings';
3+
import { useSettings } from 'hooks/useSettings';
44
import { theme as themeLight } from './theme/light';
55
import { theme as themeDark } from './theme/dark';
66

Diff for: src/api/runtime.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
import { callParentVoid, isSandbox } from '../utils';
1+
import { callParentVoid, isSandbox } from 'utils';
22

33
class SandboxRuntime {
44
getManifest(): ReturnType<typeof chrome.runtime.getManifest> {
55
return {
66
manifest_version: 3,
77
name: 'Net logs',
8-
version: '1.5.0'
8+
version: '1.6.0'
99
};
1010
}
1111

Diff for: src/components/DebuggerButton.tsx

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import React, { FC, useEffect, useState } from 'react';
22
import { IconButton, ICONS } from './IconButton';
3-
import { callParentVoid, subscribeParent } from '../utils';
3+
import { callParentVoid, subscribeParent } from 'utils';
4+
import { i18n } from 'translations/i18n';
45

56
export const DebuggerButton: FC = () => {
67
const [isActive, setIsActive] = useState(false);
@@ -11,8 +12,8 @@ export const DebuggerButton: FC = () => {
1112
};
1213
const icon = isActive ? ICONS.debugOn : ICONS.debugOff;
1314
const title = isActive
14-
? 'WebSockets are listened'
15-
: 'Click to listen WebSockets';
15+
? i18n.t('websocketsActive')
16+
: i18n.t('clickToListen');
1617

1718
useEffect(() => {
1819
callParentVoid('debugger.getStatus');

Diff for: src/components/ErrorBoundary.tsx

+4-7
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import React, { Component, ErrorInfo } from 'react';
2-
import { callParentVoid } from '../utils';
2+
import { callParentVoid } from 'utils';
3+
import { i18n } from 'translations/i18n';
34

45
type TState = { hasError: boolean; error: Error | null };
56
export default class ErrorBoundary extends Component<
@@ -17,13 +18,9 @@ export default class ErrorBoundary extends Component<
1718
}
1819

1920
componentDidCatch(error: Error, errorInfo: ErrorInfo): void {
20-
// You can also log the error to an error reporting service
21-
console.info(
22-
'A following error occurred. This may indicate problems with custom functions or bug in the extension'
23-
);
2421
console.error(error, errorInfo);
2522
callParentVoid(
26-
'analytics.error',
23+
`analytics.error`,
2724
JSON.stringify({
2825
message: error.message,
2926
stack: errorInfo.componentStack
@@ -37,7 +34,7 @@ export default class ErrorBoundary extends Component<
3734
const error = this.state.error;
3835
return (
3936
<div>
40-
<h1>Something went wrong.</h1>
37+
<h1>{i18n.t('errorOccurred')}</h1>
4138
<div>{error?.message}</div>
4239
<pre>{error?.stack}</pre>
4340
</div>

Diff for: src/components/Footer.tsx

+12-9
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,12 @@ import React, { FC } from 'react';
22
import { createUseStyles } from 'react-jss';
33
import { IconButton, ICONS } from './IconButton';
44
import { TagList } from './TagList';
5-
import { useSettings } from '../hooks/useSettings';
6-
import { useListStore } from '../controllers/network';
5+
import { useSettings } from 'hooks/useSettings';
6+
import { useListStore } from 'controllers/network';
77
import { Link } from './Link';
88
import runtime from '../api/runtime';
9-
import { Theme } from '../theme/types';
9+
import { Theme } from 'theme/types';
10+
import { i18n } from 'translations/i18n';
1011

1112
const useStyles = createUseStyles<Theme>((theme) => ({
1213
root: {
@@ -35,7 +36,9 @@ const useStyles = createUseStyles<Theme>((theme) => ({
3536
height: '24px',
3637
display: 'flex',
3738
justifyContent: 'center',
38-
cursor: 'pointer'
39+
alignItems: 'center',
40+
cursor: 'pointer',
41+
flexWrap: 'wrap'
3942
}
4043
}));
4144
export const Footer: FC<{
@@ -72,23 +75,23 @@ export const Footer: FC<{
7275
<IconButton
7376
icon={ICONS.panelUp}
7477
onClick={() => setTagListVisible(!tagsToolbarVisible)}
75-
title='Tag list'
78+
title={i18n.t('tagList')}
7679
active={tagsToolbarVisible}
7780
/>
7881
<input
7982
type='text'
80-
placeholder='Filter by url'
83+
placeholder={i18n.t('filterByUrl')}
8184
value={value}
8285
onChange={(e) => onValueChange(e.target.value)}
8386
/>
8487
<span className={styles.countWrapper}>
85-
{visibleCount} / {totalCount} requests
86-
{isPreserve && ', log preserved'}
88+
{visibleCount} / {totalCount} {i18n.t('requests')}
89+
{isPreserve && `, ${i18n.t('log preserved')}`}
8790
</span>
8891
<button
8992
className={styles.themeButton}
9093
onClick={handleThemeChange}
91-
title='Change theme'>
94+
title={i18n.t('changeTheme')}>
9295
{settings.theme === 'light' ? '🌞' : '🌑'}
9396
</button>
9497
<div className={styles.version}>v.{version}</div>

Diff for: src/components/Header.tsx

+19-17
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,17 @@
11
import React, { FC, useRef, useState } from 'react';
22
import { createUseStyles } from 'react-jss';
33
import cn from 'classnames';
4-
import { useListStore } from '../controllers/network';
4+
import { useListStore } from 'controllers/network';
55
import runtime from '../api/runtime';
66
import { Har } from 'har-format';
7-
import { callParent, isExtension } from '../utils';
7+
import { callParent, isExtension } from 'utils';
88
import { IconButton, ICONS } from './IconButton';
9-
import { useHotkey } from '../hooks/useHotkey';
9+
import { useHotkey } from 'hooks/useHotkey';
1010
import { MimetypeSelect } from './MimetypeSelect';
1111
import { toast } from 'react-toastify';
1212
import { DebuggerButton } from './DebuggerButton';
13-
import { Theme } from '../theme/types';
13+
import { Theme } from 'theme/types';
14+
import { i18n } from 'translations/i18n';
1415

1516
const useStyles = createUseStyles<Theme>((theme) => ({
1617
root: {
@@ -73,9 +74,9 @@ const doExport = () => {
7374
})
7475
),
7576
{
76-
pending: 'Exporting...',
77-
success: 'Exported',
78-
error: 'Error exporting'
77+
pending: i18n.t('exporting'),
78+
success: i18n.t('exported'),
79+
error: i18n.t('exportError')
7980
}
8081
);
8182
};
@@ -126,17 +127,17 @@ export const Header: FC<IProps> = ({
126127
<IconButton
127128
icon={ICONS.clear}
128129
onClick={clear}
129-
title='Clear [Ctrl+L]'
130+
title={`${i18n.t('clear')} [Ctrl+L]`}
130131
/>
131132
<DebuggerButton />
132133
<IconButton
133134
icon={ICONS.panelDown}
134135
onClick={() => setSecondRowVisible(!secondRowVisible)}
135-
title='Filter options'
136+
title={i18n.t('filterOptions')}
136137
active={secondRowVisible}
137138
/>
138139
<IconButton
139-
title='Case sensitive'
140+
title={i18n.t('caseSensitive')}
140141
onClick={() => onCaseSensitiveChange(!caseSensitive)}
141142
active={caseSensitive}>
142143
Aa
@@ -145,14 +146,15 @@ export const Header: FC<IProps> = ({
145146
active={isUnpack}
146147
icon={ICONS.brackets}
147148
onClick={handleToggleUnpack}
148-
title='Unpack JSON from strings'
149+
title={i18n.t('decodeJSON')}
149150
/>
150151
<input
152+
className={styles.searchBox}
151153
ref={ref}
152154
type='search'
153-
placeholder='Search in params/result'
155+
placeholder={i18n.t('searchHelp')}
154156
value={searchValue}
155-
title='Search [Ctrl+F]'
157+
title={`${i18n.t('search')} [Ctrl+F]`}
156158
onChange={(e) => onSearchChange(e.target.value)}
157159
/>
158160
{searchValue && (
@@ -163,7 +165,7 @@ export const Header: FC<IProps> = ({
163165
onChange={(e) =>
164166
onHideUnrelatedChange(e.target.checked)
165167
}
166-
title='Toggle unrelated[Ctrl+U]'
168+
title={`${i18n.t('toggleUnrelated')} [Ctrl+U]`}
167169
/>
168170
Hide unrelated
169171
</label>
@@ -174,14 +176,14 @@ export const Header: FC<IProps> = ({
174176
className={styles.optionsButton}
175177
icon={ICONS.settings}
176178
onClick={() => runtime.openOptionsPage()}
177-
title='Options'
179+
title={i18n.t('options')}
178180
/>
179181
)}
180182
<IconButton
181183
className={cn({ [styles.optionsButton]: !isExtension() })}
182184
icon={ICONS.export}
183185
onClick={doExport}
184-
title='Export'
186+
title={i18n.t('export')}
185187
/>
186188
</div>
187189
{secondRowVisible && (
@@ -192,7 +194,7 @@ export const Header: FC<IProps> = ({
192194
onChange={handlePreserveChange}
193195
checked={isPreserve}
194196
/>
195-
Preserve log
197+
{i18n.t('preserveLog')}
196198
</label>
197199
</div>
198200
)}

Diff for: src/components/IconButton.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { createUseStyles } from 'react-jss';
33
import largeIcons from '../icons/largeIcons.svg';
44
import cn from 'classnames';
55
import { google } from 'base16';
6-
import { Theme } from '../theme/types';
6+
import { Theme } from 'theme/types';
77

88
const useStyles = createUseStyles<Theme>((theme) => ({
99
button: {

Diff for: src/components/InspectorWrapper.tsx

+3-3
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@ import Inspector, {
55
DOMInspector
66
} from 'react-inspector';
77
import { Image } from './render/Image';
8-
import { useListStore } from '../controllers/network';
8+
import { useListStore } from 'controllers/network';
99
import { Webm } from './render/Webm';
10-
import { isSerializedObject } from '../utils';
10+
import { isSerializedObject } from 'utils';
1111
import { AudioPreview } from './render/AudioPreview';
12-
import { useSettings } from '../hooks/useSettings';
12+
import { useSettings } from 'hooks/useSettings';
1313

1414
type TDomData = {
1515
__mimeType: 'text/html';

Diff for: src/components/List.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import React, { FC } from 'react';
22
import { createUseStyles } from 'react-jss';
33
import { Empty } from './list/Empty';
4-
import { mediaQuerySmallOnly } from '../utils';
5-
import { ItemList } from '../controllers/network';
4+
import { mediaQuerySmallOnly } from 'utils';
5+
import { ItemList } from 'controllers/network';
66
import { Row } from './Row';
77

88
const useStyles = createUseStyles({

Diff for: src/components/MimetypeSelect.tsx

+22-4
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
1-
import React, { FC, memo, useCallback, useState } from 'react';
1+
import React, { FC, memo, useCallback, useMemo, useState } from 'react';
22
import { createUseStyles } from 'react-jss';
3-
import { useListStore } from '../controllers/network';
3+
import { useListStore } from 'controllers/network';
44
import { MultiSelect } from 'react-multi-select-component';
55
import isEqual from 'lodash.isequal';
66
import settings from '../controllers/settings';
7-
import { callParentVoid } from '../utils';
8-
import { Theme } from '../theme/types';
7+
import { callParentVoid } from 'utils';
8+
import { Theme } from 'theme/types';
9+
import { useSettings } from 'hooks/useSettings';
10+
import { i18n } from 'translations/i18n';
911

1012
const useStyles = createUseStyles<Theme>((theme) => ({
1113
root: {
@@ -40,6 +42,7 @@ const useHiddenMimeTypes = () => {
4042

4143
export const MimetypeSelect: FC = memo(() => {
4244
const styles = useStyles();
45+
const [{ language }] = useSettings();
4346
const mimeTypes = useListStore((state) => state.mimeTypes, isEqual);
4447
const sortedMimeTypes = Array.from(mimeTypes).sort();
4548
const [hiddenMimeTypes, setHiddenMimeTypes] = useHiddenMimeTypes();
@@ -48,6 +51,20 @@ export const MimetypeSelect: FC = memo(() => {
4851
.map((i) => ({ label: i, value: i }));
4952
const options = sortedMimeTypes.map((i) => ({ label: i, value: i }));
5053

54+
const overrideStrings = useMemo(
55+
() => ({
56+
allItemsAreSelected: i18n.t('allSelected'),
57+
clearSearch: i18n.t('clearSearch'),
58+
clearSelected: i18n.t('clearSelected'),
59+
noOptions: i18n.t('noOptions'),
60+
search: i18n.t('search'),
61+
selectAll: i18n.t('selectAll'),
62+
selectAllFiltered: i18n.t('selectAllFiltered'),
63+
selectSomeItems: i18n.t('selectSomeItems')
64+
}),
65+
[language]
66+
);
67+
5168
const handleOnChange = (
5269
selectedOptions: { label: string; value: string }[]
5370
) => {
@@ -67,6 +84,7 @@ export const MimetypeSelect: FC = memo(() => {
6784
value={selectedTypes}
6885
labelledBy='Mimetype'
6986
onChange={handleOnChange}
87+
overrideStrings={overrideStrings}
7088
/>
7189
);
7290
});

0 commit comments

Comments
 (0)