Adding hindi template.

This commit is contained in:
Dessalines 2020-05-01 21:51:04 -04:00
parent 9b93d4c098
commit 43592c32d9
3 changed files with 16 additions and 5 deletions

4
ui/src/i18next.ts vendored
View File

@ -13,14 +13,18 @@ import { it } from './translations/it';
import { fi } from './translations/fi'; import { fi } from './translations/fi';
import { ca } from './translations/ca'; import { ca } from './translations/ca';
import { fa } from './translations/fa'; import { fa } from './translations/fa';
import { hi } from './translations/hi';
import { pt_BR } from './translations/pt_BR'; import { pt_BR } from './translations/pt_BR';
import { ja } from './translations/ja'; import { ja } from './translations/ja';
import { ka } from './translations/ka';
// https://github.com/nimbusec-oss/inferno-i18next/blob/master/tests/T.test.js#L66 // https://github.com/nimbusec-oss/inferno-i18next/blob/master/tests/T.test.js#L66
const resources = { const resources = {
en, en,
eo, eo,
es, es,
ka,
hi,
de, de,
zh, zh,
fr, fr,

14
ui/src/utils.ts vendored
View File

@ -13,6 +13,7 @@ import 'moment/locale/fa';
import 'moment/locale/pt-br'; import 'moment/locale/pt-br';
import 'moment/locale/ja'; import 'moment/locale/ja';
import 'moment/locale/ka'; import 'moment/locale/ka';
import 'moment/locale/hi';
import { import {
UserOperation, UserOperation,
@ -62,6 +63,7 @@ export const languages = [
{ code: 'es', name: 'Español' }, { code: 'es', name: 'Español' },
{ code: 'de', name: 'Deutsch' }, { code: 'de', name: 'Deutsch' },
{ code: 'ka', name: 'ქართული ენა' }, { code: 'ka', name: 'ქართული ენა' },
{ code: 'hi', name: 'मानक हिन्दी' },
{ code: 'fa', name: 'فارسی' }, { code: 'fa', name: 'فارسی' },
{ code: 'ja', name: '日本語' }, { code: 'ja', name: '日本語' },
{ code: 'pt_BR', name: 'Português Brasileiro' }, { code: 'pt_BR', name: 'Português Brasileiro' },
@ -118,11 +120,11 @@ export const md = new markdown_it({
typographer: true, typographer: true,
}) })
.use(markdown_it_container, 'spoiler', { .use(markdown_it_container, 'spoiler', {
validate: function(params: any) { validate: function (params: any) {
return params.trim().match(/^spoiler\s+(.*)$/); return params.trim().match(/^spoiler\s+(.*)$/);
}, },
render: function(tokens: any, idx: any) { render: function (tokens: any, idx: any) {
var m = tokens[idx].info.trim().match(/^spoiler\s+(.*)$/); var m = tokens[idx].info.trim().match(/^spoiler\s+(.*)$/);
if (tokens[idx].nesting === 1) { if (tokens[idx].nesting === 1) {
@ -138,7 +140,7 @@ export const md = new markdown_it({
defs: objectFlip(emojiShortName), defs: objectFlip(emojiShortName),
}); });
md.renderer.rules.emoji = function(token, idx) { md.renderer.rules.emoji = function (token, idx) {
return twemoji.parse(token[idx].content); return twemoji.parse(token[idx].content);
}; };
@ -284,7 +286,7 @@ export function debounce(
let timeout: any; let timeout: any;
// Calling debounce returns a new anonymous function // Calling debounce returns a new anonymous function
return function() { return function () {
// reference the context and args for the setTimeout function // reference the context and args for the setTimeout function
var context = this, var context = this,
args = arguments; args = arguments;
@ -300,7 +302,7 @@ export function debounce(
clearTimeout(timeout); clearTimeout(timeout);
// Set the new timeout // Set the new timeout
timeout = setTimeout(function() { timeout = setTimeout(function () {
// Inside the timeout function, clear the timeout variable // Inside the timeout function, clear the timeout variable
// which will let the next execution run when in 'immediate' mode // which will let the next execution run when in 'immediate' mode
timeout = null; timeout = null;
@ -366,6 +368,8 @@ export function getMomentLanguage(): string {
lang = 'ja'; lang = 'ja';
} else if (lang.startsWith('ka')) { } else if (lang.startsWith('ka')) {
lang = 'ka'; lang = 'ka';
} else if (lang.startsWith('hi')) {
lang = 'hi';
} else { } else {
lang = 'en'; lang = 'en';
} }

3
ui/translations/hi.json vendored Normal file
View File

@ -0,0 +1,3 @@
{
}