Skip to content

Commit

Permalink
Add full JSDoc context and types to translation global (#196)
Browse files Browse the repository at this point in the history
* Add jsdoc

* Add typed i18n key auto-suggestions

---------

Co-authored-by: JSKitty <jskitty@protonmail.com>
  • Loading branch information
Duddino and JSKitty authored Sep 17, 2023
1 parent d73f97d commit 62dbdb8
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion locale/template/translation.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
var translation = {
export const translation_template = {
// This document is to be used as a template as all the base code is in English
// Basic HTML tags are allowed such as <b><i> etc. All data is sanitized https://developer.mozilla.org/en-US/docs/Web/API/Element/innerHTML

Expand Down
9 changes: 8 additions & 1 deletion scripts/i18n.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { translation_template } from '../locale/template/translation.js';

Check warning on line 1 in scripts/i18n.js

View workflow job for this annotation

GitHub Actions / ESLint

scripts/i18n.js#L1

'translation_template' is defined but never used (@typescript-eslint/no-unused-vars)
import { en_translation } from '../locale/en/translation.js';
import { pt_br_translation } from '../locale/pt-br/translation.js';
import { pt_pt_translation } from '../locale/pt-pt/translation.js';
Expand All @@ -14,7 +15,14 @@ import { masterKey } from './wallet.js';
import { getNetwork } from './network.js';
import { cReceiveType, guiToggleReceiveType } from './contacts-book.js';

/**
* @type {translation_template}
*/
export const ALERTS = {};

/**
* @type {translation_template}
*/
export let translation = {};

// TRANSLATION
Expand Down Expand Up @@ -99,7 +107,6 @@ export function tr(message, variables) {
/**
* Translates all static HTML based on the `data-i18n` tag
* @param {Array} i18nLangs
*
*/
export function translateStaticHTML(i18nLangs) {
if (!i18nLangs) return;
Expand Down

0 comments on commit 62dbdb8

Please sign in to comment.