Fetching latest headlines…
Building a Local-Only Browser Extension That Translates GitHub's UI—Not Your Content
NORTH AMERICA
🇺🇸 United StatesJuly 11, 2026

Building a Local-Only Browser Extension That Translates GitHub's UI—Not Your Content

0 views0 likes0 comments
Originally published byDev.to

Built-in browser translation is convenient, but it is often too broad for developer tools. It can translate repository content along with the interface, turning terms such as "branch" into awkward words and making technical pages harder to read.

There is also a more serious concern in corporate environments: depending on the translation feature or service being used, page content may be sent to an external translation provider. That can be unacceptable when a page contains private repository code, internal issue discussions, or other confidential information.

I wanted a narrower and more predictable solution:

  • Translate only GitHub's fixed interface labels
  • Leave README files, issues, comments, and source code untouched
  • Never send text to an external translation API or cloud translation service
  • Perform the entire translation locally in the browser

So I built GitHub UI Translator, an open-source browser extension for Chrome and Firefox.

GitHub logo nobuo-miura / github-ui-translator

A Chrome extension that translates the GitHub UI into multiple languages using local dictionaries.

GitHub UI Translator

English | 日本語

GitHub UI Translator is a browser extension (Chrome and Firefox) that translates GitHub's English UI into Japanese using a local dictionary It does not rely on external translation APIs or cloud services; all translation runs locally in the browser.

This project is currently an MVP (Minimum Viable Product).

Features

  • Runs entirely locally, with no external network requests
  • Translates fixed GitHub UI text such as navigation items and buttons while avoiding content areas such as READMEs, issues, comments, and code blocks
  • Lets you turn translation on or off from the extension popup

Current Limitations

  • Only Japanese is supported.
  • Dynamic text that includes numbers, dates, or user names, such as "3 commits" or "opened 2 days ago", is not translated.
  • Only github.com is supported. GitHub Enterprise and other custom domains are not supported.
  • Tested on Chrome and Firefox. Other Chromium-based browsers (Edge, Brave, etc.) should also…

The initial bundled dictionary translates GitHub's interface into Japanese, but the design is not tied to any particular language.

The Main Design Goal: Decide What Not to Translate

A straightforward translation extension could scan every text node on the page and replace matching strings. The problem is that GitHub pages contain both interface text and user-generated content.

Translating the whole page could modify:

  • README files
  • Issue and pull request descriptions
  • Comments
  • Code blocks
  • Repository file content

For this extension, leaving those areas untouched is more important than translating every possible label.

Instead of scanning the entire document, the extension starts with an allowlist of semantic UI elements:

const BASE_SELECTOR = [
  'nav',
  'header',
  'button',
  'input[type="submit"]',
  'input[type="button"]',
  'input[type="reset"]',
  '[role="tab"]',
  '[role="menuitem"]',
  '[role="menuitemradio"]',
  '[role="menuitemcheckbox"]',
  '[role="menu"]',
  '[role="dialog"]',
  '[role="listbox"]',
  '[role="button"]',
  '[aria-label]'
];

These selectors describe the meaning of an element rather than GitHub's visual implementation. CSS class names and data-testid values can change during a refactor, while elements such as nav and ARIA roles are more closely tied to how the interface works.

Some GitHub pages, including Settings and Issue or Pull Request screens, contain fixed interface text in headings, labels, and links. On those pages, the extension expands the allowlist based on the URL. Content containers such as .markdown-body are still explicitly excluded.

This approach is intentionally conservative. Missing a label is preferable to modifying content written by a user.

Exact Matches Instead of Machine Translation

The extension does not use a machine translation model. It replaces text only when the complete string matches an entry in its bundled dictionary.

For example:

{
  "language": "ja",
  "name": "日本語",
  "translations": {
    // Repository navigation
    "Code": "コード",
    "Issues": "イシュー",
    "Pull requests": "プルリクエスト",

    // Repository actions
    "Watch": "ウォッチ",
    "Star": "スター"
  }
}

Dynamic strings such as 3 commits or opened 2 days ago do not match a dictionary entry, so they remain in English.

That limits translation coverage, but it also provides a useful safety property: unknown text is displayed exactly as GitHub provided it. There is no generated translation that can unexpectedly change the meaning of a technical term.

Translation is not limited to visible text nodes: matching aria-label values, placeholder attributes, and button value attributes are also translated, so relevant labels used by assistive technologies are covered as well.

Keeping Confidential Content Away from Translation Services

The dictionary is bundled with the extension. Translation is a local string-matching operation performed inside the browser.

The extension does not send page text to an external translation API or cloud translation service. It does not need to upload a README, issue discussion, pull request description, or source file to produce a translation.

This distinction matters in organizations where private repositories contain confidential code or internal discussions. Even when an external translation service is useful, company policy may prohibit sending repository content to it.

GitHub UI Translator reduces that concern in two complementary ways:

  1. User-generated content is excluded from translation targets.
  2. The interface text that is translated is processed locally with a bundled dictionary.

The goal is not to replace general-purpose translation. It is to provide a small, auditable tool for one specific job: translating predictable interface labels without involving repository content.

Why the Dictionary Uses Commented Sections

The Japanese dictionary contains nearly 1,000 entries. A flat JSON file quickly becomes difficult to maintain because it is not obvious which GitHub screen each label belongs to.

The dictionary therefore uses JSON with line comments to group entries by screen or feature. Before parsing the file, the extension removes the comment lines and passes the remaining content to JSON.parse.

This makes it easier to find and update the relevant section when GitHub changes an interface label. It also keeps language contributions approachable: adding another language mainly involves supplying another dictionary rather than changing the translation logic.

Current Trade-Offs

The conservative design comes with some limitations:

  • Japanese is currently the only included language.
  • Dynamic labels containing numbers, dates, or usernames remain in English.
  • GitHub Enterprise domains are not currently supported.
  • The extension has been tested on Chrome and Firefox, but not on other Chromium-based browsers.
  • GitHub can introduce new UI structures or labels that are not yet in the allowlist or dictionary.

These are acceptable trade-offs for the initial version. The fallback is always the original GitHub text, not a guessed translation.

What's Next

I would like to expand the dictionary coverage and add more languages while keeping the same local-only, UI-only approach.

If you are interested in contributing a dictionary, reporting an untranslated GitHub label, or reviewing the implementation, the project is available on GitHub:

GitHub logo nobuo-miura / github-ui-translator

A Chrome extension that translates the GitHub UI into multiple languages using local dictionaries.

GitHub UI Translator

English | 日本語

GitHub UI Translator is a browser extension (Chrome and Firefox) that translates GitHub's English UI into Japanese using a local dictionary It does not rely on external translation APIs or cloud services; all translation runs locally in the browser.

This project is currently an MVP (Minimum Viable Product).

Features

  • Runs entirely locally, with no external network requests
  • Translates fixed GitHub UI text such as navigation items and buttons while avoiding content areas such as READMEs, issues, comments, and code blocks
  • Lets you turn translation on or off from the extension popup

Current Limitations

  • Only Japanese is supported.
  • Dynamic text that includes numbers, dates, or user names, such as "3 commits" or "opened 2 days ago", is not translated.
  • Only github.com is supported. GitHub Enterprise and other custom domains are not supported.
  • Tested on Chrome and Firefox. Other Chromium-based browsers (Edge, Brave, etc.) should also…

Comments (0)

Sign in to join the discussion

Be the first to comment!