Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • TransFem-org/Sharkey
  • fEmber/Sharkey
  • kopper/Sharkey
  • dakkar/Sharkey-thenautilus
  • esm/Sharkey
  • blueb/Sharkey
  • aura/Sharkey
  • alicem/Sharkey
  • dimkr/Sharkey
  • vvinrg/Sharkey
  • tess/Sharkey
  • Latte_macchiato/Sharkey
  • skyevg/Sharkey
  • TransFem-org/sharkey-trans-fem
  • limepotato/sharkey
  • elrant/villkey
  • kio/kitsukey
  • 4censord/Sharkey
  • kanade/Sharkey
  • kakkokari-gtyih/Sharkey
  • piuvas/Sharkey
  • kio/gaykey
  • owlbear/Sharkey
  • esurio/Sharkey
  • cuteBoiButt/Sharkey
  • magi/Sharkey
  • chikorita157/Sharkey
  • CenTdemeern1/Sharkey
  • GeopJr/Sharkey
  • lhcfl/sharkey
  • cody/Sharkey
  • puppygirlhornypost/Sharkey
  • Sneexy/Sharkey
  • zotan/Sharkey
  • Marie/Sharkey
  • maciejla/Sharkey
  • transitory/Sharkey
  • Caramel/Sharkey
  • fly_mc/Sharkey
  • 87/Sharkey
  • echo/Sharkey
  • transfemsoc/Sharkey
  • ch0ccyra1n/Sharkey
  • interru/Sharkey
  • legiayayana/Sharkey
  • elizabeth-dev/Sharkey
  • JeDaYoshi/Sharkey
  • bunnybeam/Sharkey
  • and-then-there-were-two/Sharkey
  • easrng/Sharkey
  • HellhoundSoftware/Sharkey
  • realkinetix/Sharkey
  • sandervankasteel/Sharkey
  • jacobwhall/Sharkey
  • Daniel/Sharkey
  • rhythmkey/rhythmkey
56 results
Show changes
Showing with 14686 additions and 1072 deletions
...@@ -301,8 +301,6 @@ _theme: ...@@ -301,8 +301,6 @@ _theme:
_sfx: _sfx:
note: "Σημειώματα" note: "Σημειώματα"
notification: "Ειδοποιήσεις" notification: "Ειδοποιήσεις"
antenna: "Αντένες"
channel: "Ειδοποιήσεις καναλιών"
_ago: _ago:
future: "Μελλοντικό" future: "Μελλοντικό"
justNow: "Μόλις τώρα" justNow: "Μόλις τώρα"
...@@ -356,6 +354,7 @@ _profile: ...@@ -356,6 +354,7 @@ _profile:
username: "Όνομα μέλους" username: "Όνομα μέλους"
_exportOrImport: _exportOrImport:
allNotes: "Όλα τα σημειώματα" allNotes: "Όλα τα σημειώματα"
clips: "Κλιπ"
followingList: "Ακολουθεί" followingList: "Ακολουθεί"
muteList: "Μέλη σε σίγαση" muteList: "Μέλη σε σίγαση"
blockingList: "Μπλοκαρισμένα μέλη" blockingList: "Μπλοκαρισμένα μέλη"
...@@ -379,6 +378,7 @@ _notification: ...@@ -379,6 +378,7 @@ _notification:
renote: "Κοινοποίηση σημειώματος" renote: "Κοινοποίηση σημειώματος"
quote: "Παράθεση" quote: "Παράθεση"
reaction: "Αντιδράσεις" reaction: "Αντιδράσεις"
login: "Σύνδεση"
_actions: _actions:
reply: "Απάντηση" reply: "Απάντηση"
renote: "Κοινοποίηση σημειώματος" renote: "Κοινοποίηση σημειώματος"
...@@ -395,3 +395,5 @@ _webhookSettings: ...@@ -395,3 +395,5 @@ _webhookSettings:
name: "Όνομα" name: "Όνομα"
_moderationLogTypes: _moderationLogTypes:
suspend: "Αποβολή" suspend: "Αποβολή"
_reversi:
total: "Σύνολο"
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -3,57 +3,186 @@ import { fileURLToPath } from 'node:url'; ...@@ -3,57 +3,186 @@ import { fileURLToPath } from 'node:url';
import { dirname } from 'node:path'; import { dirname } from 'node:path';
import * as yaml from 'js-yaml'; import * as yaml from 'js-yaml';
import ts from 'typescript'; import ts from 'typescript';
import { merge } from './index.js';
const __filename = fileURLToPath(import.meta.url); const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename); const __dirname = dirname(__filename);
// braces preceded by backslashes are literal, they don't represent
// parameters; they get cleaned up by `locales/index.js` before
// getting shipped to the browser
const parameterRegExp = /(?<!\\)\{(\w+)\}/g;
function createMemberType(item) {
if (typeof item !== 'string') {
return ts.factory.createTypeLiteralNode(createMembers(item));
}
const parameters = Array.from(
item.matchAll(parameterRegExp),
([, parameter]) => parameter,
);
return parameters.length
? ts.factory.createTypeReferenceNode(
ts.factory.createIdentifier('ParameterizedString'),
[
ts.factory.createUnionTypeNode(
parameters.map((parameter) =>
ts.factory.createStringLiteral(parameter),
),
),
],
)
: ts.factory.createKeywordTypeNode(ts.SyntaxKind.StringKeyword);
}
function createMembers(record) { function createMembers(record) {
return Object.entries(record) return Object.entries(record).map(([k, v]) => {
.map(([k, v]) => ts.factory.createPropertySignature( const node = ts.factory.createPropertySignature(
undefined, undefined,
ts.factory.createStringLiteral(k), ts.factory.createStringLiteral(k),
undefined, undefined,
typeof v === 'string' createMemberType(v),
? ts.factory.createKeywordTypeNode(ts.SyntaxKind.StringKeyword) );
: ts.factory.createTypeLiteralNode(createMembers(v)), if (typeof v === 'string') {
)); ts.addSyntheticLeadingComment(
node,
ts.SyntaxKind.MultiLineCommentTrivia,
`*
* ${v.replace(/\n/g, '\n * ')}
`,
true,
);
}
return node;
});
} }
export default function generateDTS() { export default function generateDTS() {
const locale = yaml.load(fs.readFileSync(`${__dirname}/ja-JP.yml`, 'utf-8')); const sharkeyLocale = yaml.load(fs.readFileSync(`${__dirname}/../sharkey-locales/en-US.yml`, 'utf-8'));
const misskeyLocale = yaml.load(fs.readFileSync(`${__dirname}/ja-JP.yml`, 'utf-8'));
const locale = merge(misskeyLocale, sharkeyLocale);
const members = createMembers(locale); const members = createMembers(locale);
const elements = [ const elements = [
ts.factory.createInterfaceDeclaration(
[ts.factory.createToken(ts.SyntaxKind.ExportKeyword)],
ts.factory.createIdentifier('Locale'),
undefined,
undefined,
members,
),
ts.factory.createVariableStatement( ts.factory.createVariableStatement(
[ts.factory.createToken(ts.SyntaxKind.DeclareKeyword)], [ts.factory.createToken(ts.SyntaxKind.DeclareKeyword)],
ts.factory.createVariableDeclarationList( ts.factory.createVariableDeclarationList(
[ts.factory.createVariableDeclaration( [
ts.factory.createIdentifier('locales'), ts.factory.createVariableDeclaration(
ts.factory.createIdentifier('kParameters'),
undefined,
ts.factory.createTypeOperatorNode(
ts.SyntaxKind.UniqueKeyword,
ts.factory.createKeywordTypeNode(ts.SyntaxKind.SymbolKeyword),
),
undefined,
),
],
ts.NodeFlags.Const,
),
),
ts.factory.createInterfaceDeclaration(
[ts.factory.createToken(ts.SyntaxKind.ExportKeyword)],
ts.factory.createIdentifier('ParameterizedString'),
[
ts.factory.createTypeParameterDeclaration(
undefined,
ts.factory.createIdentifier('T'),
ts.factory.createKeywordTypeNode(ts.SyntaxKind.StringKeyword),
ts.factory.createKeywordTypeNode(ts.SyntaxKind.StringKeyword),
),
],
undefined,
[
ts.factory.createPropertySignature(
undefined, undefined,
ts.factory.createTypeLiteralNode([ts.factory.createIndexSignature( ts.factory.createComputedPropertyName(
ts.factory.createIdentifier('kParameters'),
),
undefined,
ts.factory.createTypeReferenceNode(
ts.factory.createIdentifier('T'),
undefined, undefined,
[ts.factory.createParameterDeclaration( ),
),
],
),
ts.factory.createInterfaceDeclaration(
[ts.factory.createToken(ts.SyntaxKind.ExportKeyword)],
ts.factory.createIdentifier('ILocale'),
undefined,
undefined,
[
ts.factory.createIndexSignature(
undefined,
[
ts.factory.createParameterDeclaration(
undefined, undefined,
undefined, undefined,
ts.factory.createIdentifier('lang'), ts.factory.createIdentifier('_'),
undefined, undefined,
ts.factory.createKeywordTypeNode(ts.SyntaxKind.StringKeyword), ts.factory.createKeywordTypeNode(ts.SyntaxKind.StringKeyword),
undefined, undefined,
)], ),
],
ts.factory.createUnionTypeNode([
ts.factory.createKeywordTypeNode(ts.SyntaxKind.StringKeyword),
ts.factory.createTypeReferenceNode(
ts.factory.createIdentifier('ParameterizedString'),
),
ts.factory.createTypeReferenceNode( ts.factory.createTypeReferenceNode(
ts.factory.createIdentifier('Locale'), ts.factory.createIdentifier('ILocale'),
undefined, undefined,
), ),
)]), ]),
undefined, ),
)], ],
ts.NodeFlags.Const | ts.NodeFlags.Ambient | ts.NodeFlags.ContextFlags, ),
ts.factory.createInterfaceDeclaration(
[ts.factory.createToken(ts.SyntaxKind.ExportKeyword)],
ts.factory.createIdentifier('Locale'),
undefined,
[
ts.factory.createHeritageClause(ts.SyntaxKind.ExtendsKeyword, [
ts.factory.createExpressionWithTypeArguments(
ts.factory.createIdentifier('ILocale'),
undefined,
),
]),
],
members,
),
ts.factory.createVariableStatement(
[ts.factory.createToken(ts.SyntaxKind.DeclareKeyword)],
ts.factory.createVariableDeclarationList(
[
ts.factory.createVariableDeclaration(
ts.factory.createIdentifier('locales'),
undefined,
ts.factory.createTypeLiteralNode([
ts.factory.createIndexSignature(
undefined,
[
ts.factory.createParameterDeclaration(
undefined,
undefined,
ts.factory.createIdentifier('lang'),
undefined,
ts.factory.createKeywordTypeNode(
ts.SyntaxKind.StringKeyword,
),
undefined,
),
],
ts.factory.createTypeReferenceNode(
ts.factory.createIdentifier('Locale'),
undefined,
),
),
]),
undefined,
),
],
ts.NodeFlags.Const,
), ),
), ),
ts.factory.createFunctionDeclaration( ts.factory.createFunctionDeclaration(
...@@ -70,16 +199,39 @@ export default function generateDTS() { ...@@ -70,16 +199,39 @@ export default function generateDTS() {
), ),
ts.factory.createExportDefault(ts.factory.createIdentifier('locales')), ts.factory.createExportDefault(ts.factory.createIdentifier('locales')),
]; ];
const printed = ts.createPrinter({ ts.addSyntheticLeadingComment(
newLine: ts.NewLineKind.LineFeed, elements[0],
}).printList( ts.SyntaxKind.MultiLineCommentTrivia,
ts.ListFormat.MultiLine, ' eslint-disable ',
ts.factory.createNodeArray(elements), true,
ts.createSourceFile('index.d.ts', '', ts.ScriptTarget.ESNext, true, ts.ScriptKind.TS),
); );
ts.addSyntheticLeadingComment(
elements[0],
ts.SyntaxKind.SingleLineCommentTrivia,
' This file is generated by locales/generateDTS.js',
true,
);
ts.addSyntheticLeadingComment(
elements[0],
ts.SyntaxKind.SingleLineCommentTrivia,
' Do not edit this file directly.',
true,
);
const printed = ts
.createPrinter({
newLine: ts.NewLineKind.LineFeed,
})
.printList(
ts.ListFormat.MultiLine,
ts.factory.createNodeArray(elements),
ts.createSourceFile(
'index.d.ts',
'',
ts.ScriptTarget.ESNext,
true,
ts.ScriptKind.TS,
),
);
fs.writeFileSync(`${__dirname}/index.d.ts`, `/* eslint-disable */ fs.writeFileSync(`${__dirname}/index.d.ts`, printed, 'utf-8');
// This file is generated by locales/generateDTS.js
// Do not edit this file directly.
${printed}`, 'utf-8');
} }
--- ---
_lang_: "Japán" _lang_: "Magyar"
monthAndDay: "{month}.{day}." monthAndDay: "{month}.{day}."
search: "Keresés" search: "Keresés"
notifications: "Értesítések" notifications: "Értesítések"
...@@ -96,6 +96,7 @@ _notification: ...@@ -96,6 +96,7 @@ _notification:
renote: "Renote" renote: "Renote"
quote: "Idézet" quote: "Idézet"
reaction: "Reakciók" reaction: "Reakciók"
login: "Bejelentkezés"
_actions: _actions:
renote: "Renote" renote: "Renote"
_deck: _deck:
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -104,3 +104,7 @@ _deck: ...@@ -104,3 +104,7 @@ _deck:
_columns: _columns:
notifications: "Ilɣuyen" notifications: "Ilɣuyen"
list: "Tibdarin" list: "Tibdarin"
_abuseReport:
_notificationRecipient:
_recipientType:
mail: "Imayl"
...@@ -77,6 +77,8 @@ _profile: ...@@ -77,6 +77,8 @@ _profile:
username: "ಬಳಕೆಹೆಸರು" username: "ಬಳಕೆಹೆಸರು"
_notification: _notification:
youWereFollowed: "ಹಿಂಬಾಲಿಸಿದರು" youWereFollowed: "ಹಿಂಬಾಲಿಸಿದರು"
_types:
login: "ಪ್ರವೇಶ"
_actions: _actions:
reply: "ಉತ್ತರಿಸು" reply: "ಉತ್ತರಿಸು"
_deck: _deck:
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.