You can (sort of) translate Obsidian's interface right now

If you’re willing and able to get your hands dirty, it’s possible to modify your CSS theme to hack in your own translations. For example:

The two Chinese fragments are what Google told me are translations for “Linked mentions” and “Unlinked mentions”. You’re looking at the backlinks pane.

I managed to do this by adding these rules to my theme:

body > div > div.horizontal-main-container > div > div.workspace-split.mod-horizontal.mod-right-split > div.workspace-tabs > div.workspace-leaf > div > div.view-content > div > div:nth-child(1) > div:nth-child(2),
body > div > div.horizontal-main-container > div > div.workspace-split.mod-horizontal.mod-right-split > div.workspace-tabs > div.workspace-leaf > div > div.view-content > div > div:nth-child(5) > div:nth-child(2) {
    font-size: 0;
}

body > div > div.horizontal-main-container > div > div.workspace-split.mod-horizontal.mod-right-split > div.workspace-tabs > div.workspace-leaf > div > div.view-content > div > div:nth-child(1) > div:nth-child(2):after {
    font-size: 1rem;
    content: "链接提及";
}

body > div > div.horizontal-main-container > div > div.workspace-split.mod-horizontal.mod-right-split > div.workspace-tabs > div.workspace-leaf > div > div.view-content > div > div:nth-child(5) > div:nth-child(2):after {
    font-size: 1rem;
    content: "未关联的提及";
}

This isn’t much help for people who don’t know how to use CSS to make their own themes, or how to use Obsidian’s built-in Web Inspector to quickly copy the relevant selectors.

But since it’s easy to copypaste gobs of text, people could compile and share translation CSS on GitHub, and then users could apply them to whatever theme they prefer just by adding them to the end of the CSS file. Detailed instructions on how to do this could be supplied in the README.md for the GitHub project.

There is a big downside to this approach, though. CSS selectors are likely to break whenever Obsidian’s underlying interface structure changes, so translations will need to be kept up to date with latest versions of Obsidian. But for suitably motivated and generous people, this could be done.

And not everything will be translatable–for example, there’s no getting (to my knowledge) at text placeholders like “Type a command…” in the command palette, or at things for which no unambiguous selector exists (like search results in the command palette).

But it’s something.

3 Likes

Very creative use of CSS! :smiley:

For the Chinese translation, I’ve seen a “汉化包” somewhere, although I’m not sure how it’s done.

1 Like