Skip to content

Demo JetBrains IDE plugin for Obsidian.md translations and plugin development

Notifications You must be signed in to change notification settings

picimako/obsidian-ecosystem

Repository files navigation

Obsidian Ecosystem - Plugin for JetBrains IDEs

This JetBrains IDE plugin provides various features for those that work with Obsidian.md's translations (mainly this area) and plugin/theme development.

The plugin is not released on the JetBrains Marketplace or on any other outlet. It's main purpose is to demonstrate that such small aspects of an ecosystem like translations can have meaningful IDE integrations, even if it is for a small number of contributors. However, the plugin is functional, so feel free to use it for actual Obsidian translation activities. You can download the plugin archive from the download directory.


Translations

The features described in this document are all created for the obsidian-translations project.

Show translation of property in another language

This intention action, available on leaf JSON properties, lets users navigate to the translation of the selected property in other languages.

It presents the user the list of available translation files, and if the property is available in the file selected, the IDE opens the file and navigates to that property.

The language names displayed inside parenthesis are their localized versions.

List of available translation files

If the property is not present in the target file, an error message is shown.

Error message for non-existent property

Generate property in en.json into all other translation files

When a new property is added in en.json because of for example new feature development, it is good practice (or is even required for proper functioning) to add that property into other translation files with its English value.

To simplify this process, this intention action can be invoked on any leaf JSON property with a String value in en.json, that will generate this property into all other translation files.

If the selected property is already present in a translation file but with a different value, this intention doesn't update that value.

For example, if you invoke the intention on newProperty here:

{
  "setting": {
    "options": "Options",
    "editor": {
      "newProperty": "value",
      "name": "Editor"
    }
  }
}

the Hungarian translation (and of course all others) will be updated from

{
  "setting": {
    "options": "Beállítások",
    "editor": {
      "name": "Szerkesztő"
    }
  }
}

to

{
  "setting": {
    "options": "Beállítások",
    "editor": {
      "newProperty": "value",
      "name": "Szerkesztő"
    }
  }
}

Delete property from all translations

During feature developments, cleanups, etc. localization keys may be removed from the application, thus in order to speed up that process, this intention action can be invoked on any leaf JSON property with a String value in en.json, and it will delete that property from all available translation files.

For example, if you invoke the intention on section-behavior here:

{
  "setting": {
    "options": "Options",
    "editor": {
      "name": "Editor",
      "section-behavior": "Behavior"
    }
  }
}

it will remove that property from all translation files like this:

{
  "setting": {
    "options": "Options",
    "editor": {
      "name": "Editor"
    }
  }
}

Variable annotations

In order to make {{...}} variables stand out in translation strings, this annotator applies styling to them.

variable annotations

Variable usage inspections

This inspection reports the following issues with {{...}} variables:

  • missing variable: one or more variables present in the English value, are not used in a translation
  • invalid variable: one or more variables are specified with names that are not present in the English value

NOTE: This inspection assumes that the variables are used by their names in Obsidian's code base, and not by index or by other means.

variable reports


Plugins and Themes

JSON schema for manifest.json

Since the manifest.json has various properties depending on the type of Obsidian plugin project, with different required states, JSON schema is available for both plugins and themes that automatically provide code completion and validation.

The schemas are assigned to the manifest.json when the project is set as a plugin or theme project in the IDE settings under Settings > Tools > Obsidian.

Plugin schema completion

manifest.json issues

This inspection reports the following issues in the manifest.json file:

  • If the description property is longer than 250 characters.
  • If the description property doesn't end with a dot.
  • If the name of the project root directory doesn't match the name property.

Completion of lucide.dev icons

This code completion provides names of lucide.dev icons in the arguments of setIcon() and addRibbonIcon() function calls.

Based on the Obsidian Icons documentation, the names are provided only up to lucide v0.292.0.

Icon completion

Reporting command ids prefixed with the plugin id

An inspection takes care of reporting command ids in Plugin.addCommand() function calls that are prefixed with the plugin id. According to the Submission requirements for plugins page it is done automatically.

Command id prefixed with plugin id

About

Demo JetBrains IDE plugin for Obsidian.md translations and plugin development

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Languages