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

Add translation to missing items #1180

Merged
merged 9 commits into from
Nov 14, 2022
4 changes: 2 additions & 2 deletions src/cloneCommand.ts
Original file line number Diff line number Diff line change
@@ -83,10 +83,10 @@ export const gitCloneCommandPlugin: JupyterFrontEndPlugin<void> = {
}
});
// Add a clone button to the file browser extension toolbar
addCloneButton(gitModel, fileBrowser, app.commands);
addCloneButton(gitModel, fileBrowser, app.commands, trans);

// Add the context menu items for the default file browser
addFileBrowserContextMenu(gitModel, fileBrowser, app.contextMenu);
addFileBrowserContextMenu(gitModel, fileBrowser, app.contextMenu, trans);
},
autoStart: true
};
7 changes: 4 additions & 3 deletions src/commandsAndMenu.tsx
Original file line number Diff line number Diff line change
@@ -1300,7 +1300,7 @@ export function createGitMenu(
];

const menu = new Menu({ commands });
menu.title.label = 'Git';
menu.title.label = trans.__('Git');
[
CommandIDs.gitInit,
CommandIDs.gitClone,
@@ -1382,7 +1382,8 @@ export function addMenuItems(
export function addFileBrowserContextMenu(
model: IGitExtension,
filebrowser: FileBrowser,
contextMenu: ContextMenuSvg
contextMenu: ContextMenuSvg,
trans: TranslationBundle
): void {
let gitMenu: Menu;
let _commands: ContextCommandIDs[];
@@ -1505,7 +1506,7 @@ export function addFileBrowserContextMenu(

const selectorNotDir = '.jp-DirListing-item[data-isdir="false"]';
gitMenu = new GitMenu({ commands: contextMenu.menu.commands });
gitMenu.title.label = 'Git';
gitMenu.title.label = trans.__('Git');
gitMenu.title.icon = gitIcon.bindprops({ stylesheet: 'menuItem' });

contextMenu.addItem({
9 changes: 7 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -201,13 +201,18 @@ async function activate(
}

// Add a clone button to the file browser extension toolbar
addCloneButton(gitExtension, fileBrowser, app.commands);
addCloneButton(gitExtension, fileBrowser, app.commands, trans);

// Add the status bar widget
addStatusBarWidget(statusBar, gitExtension, settings, trans);

// Add the context menu items for the default file browser
addFileBrowserContextMenu(gitExtension, fileBrowser, app.contextMenu);
addFileBrowserContextMenu(
gitExtension,
fileBrowser,
app.contextMenu,
trans
);
}

// Register diff providers
6 changes: 4 additions & 2 deletions src/widgets/gitClone.tsx
Original file line number Diff line number Diff line change
@@ -5,6 +5,7 @@ import {
} from '@jupyterlab/apputils';
import { IChangedArgs } from '@jupyterlab/coreutils';
import { FileBrowser } from '@jupyterlab/filebrowser';
import { TranslationBundle } from '@jupyterlab/translation';
import { CommandRegistry } from '@lumino/commands';
import * as React from 'react';
import { cloneIcon } from '../style/icons';
@@ -13,7 +14,8 @@ import { CommandIDs, IGitExtension } from '../tokens';
export function addCloneButton(
model: IGitExtension,
filebrowser: FileBrowser,
commands: CommandRegistry
commands: CommandRegistry,
trans: TranslationBundle
): void {
filebrowser.toolbar.addItem(
'gitClone',
@@ -33,7 +35,7 @@ export function addCloneButton(
onClick={() => {
commands.execute(CommandIDs.gitClone);
}}
tooltip={'Git Clone'}
tooltip={trans.__('Git Clone')}
/>
)}
</UseSignal>