Skip to content

Commit

Permalink
feat: add docs link to detections root, close #519
Browse files Browse the repository at this point in the history
  • Loading branch information
antfu committed Mar 31, 2021
1 parent 8b7c414 commit bd7f28a
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 1 deletion.
1 change: 1 addition & 0 deletions locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"command.rename_key": "Rename key",
"command.set_display_language": "Set as display language",
"command.set_source_language": "Set as source language",
"command.show_docs": "Show documentation",
"command.translate_key": "Translate",
"command.translate_key_from": "Translate from \"{0}\"",
"config.annotation_delimiter": "The delimiter for annotations",
Expand Down
11 changes: 11 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -361,6 +361,12 @@
"command": "i18n-ally.go-to-range",
"category": "%extname%",
"title": "%command.go_to_range%"
},
{
"command": "i18n-ally.open-docs-hard-string",
"category": "%extname%",
"title": "%command.show_docs%",
"icon": "$(question)"
}
],
"menus": {
Expand Down Expand Up @@ -536,6 +542,11 @@
"command": "i18n-ally.mark-key-as-in-use",
"when": "view =~ /i18n-ally-locales/ && viewItem =~ /key_idle/",
"group": "i18nally@1"
},
{
"command": "i18n-ally.open-docs-hard-string",
"when": "viewItem =~ /i18n-ally-hard-string-root/",
"group": "inline@1"
}
],
"view/title": [
Expand Down
1 change: 1 addition & 0 deletions src/commands/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ export const enum Commands {
locale_visibility_show = 'i18n-ally.locale-visibility-show',
locale_visibility_hide = 'i18n-ally.locale-visibility-hide',
open_url = 'i18n-ally.open-url',
open_docs_hard_string = 'i18n-ally.open-docs-hard-string',
support = 'i18n-ally.support',
refresh_usage = 'i18n-ally.refresh-usage',
mark_key_as_in_use = 'i18n-ally.mark-key-as-in-use',
Expand Down
6 changes: 5 additions & 1 deletion src/commands/help.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,14 @@ const m: ExtensionModule = (ctx) => {
return [
commands.registerCommand(Commands.open_url,
async(url: string) => {
// @ts-ignore
await env.openExternal(Uri.parse(url))
}),

commands.registerCommand(Commands.open_docs_hard_string,
async() => {
await env.openExternal(Uri.parse('https://github.com/lokalise/i18n-ally/wiki/Hard-coded-Strings-Extraction'))
}),

commands.registerCommand(Commands.support,
async() => {
const options = [{
Expand Down
2 changes: 2 additions & 0 deletions src/views/items/CurrentFileExtractionItem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ export class CurrentFileExtractionItem extends BaseTreeItem {
constructor(readonly provider: CurrentFileLocalesTreeProvider) {
super(provider.ctx)

this.contextValue = 'i18n-ally-hard-string-root'

this.langId = window.activeTextEditor?.document.languageId || 'unknown'
if (this.langId && Global.getExtractionFrameworksByLang(this.langId).length)
this.collapsibleState = TreeItemCollapsibleState.Collapsed
Expand Down

0 comments on commit bd7f28a

Please sign in to comment.