Fix rendering bug

This commit is contained in:
Pieter Vander Vennet 2022-04-03 23:42:35 +02:00
parent 3edca23b90
commit e62f71a51d
2 changed files with 7 additions and 0 deletions

View file

@ -12,6 +12,9 @@ export default class LinkToWeblate extends VariableUiElement {
if(availableTranslations["*"] !== undefined){
return undefined
}
if(context === undefined || context.indexOf(":") < 0){
return undefined
}
const icon = Svg.translate_svg()
.SetClass("rounded-full border border-gray-400 inline-block w-4 h-4 m-1 weblate-link self-center")
if(availableTranslations[ln] === undefined){
@ -24,6 +27,9 @@ export default class LinkToWeblate extends VariableUiElement {
}
public static hrefToWeblate(language: string, contextKey: string): string{
if(contextKey === undefined || contextKey.indexOf(":") < 0){
return undefined
}
const [category, ...rest] = contextKey.split(":")
const key = rest.join(":")

View file

@ -40,6 +40,7 @@ class TranslatorsPanelContent extends Combine {
})
const missingTranslationsFor = (ln: string) => Utils.NoNull(untranslated.get(ln) ?? [])
.filter(ctx => ctx.indexOf(":") >= 0)
.map(ctx => ctx.replace(/note_import_[a-zA-Z0-9_]*/, "note_import"))
.map(context => new Link(context, LinkToWeblate.hrefToWeblate(ln, context), true))