Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added translations of questions/answers in Swahili for MAT-LUK #128

Draft
wants to merge 6 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions Installer/Installer.wixproj
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,9 @@
<Compile Include="..\output\installer\GeneratedLocalizedPhrasesFilesP9_fr.wxs">
<Link>GeneratedLocalizedPhrasesFilesP9_fr.wxs</Link>
</Compile>
<Compile Include="..\output\installer\GeneratedLocalizedPhrasesFilesP9_sw.wxs">
<Link>GeneratedLocalizedPhrasesFilesP9_sw.wxs</Link>
</Compile>
<Compile Include="..\output\installer\GeneratedUiStringsFilesP9_ar.wxs">
<Link>GeneratedUiStringsFilesP9_ar.wxs</Link>
</Compile>
Expand Down
334,740 changes: 334,740 additions & 0 deletions Transcelerator/LocalizedPhrases-sw.xlf

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions Transcelerator/Transcelerator.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -482,6 +482,9 @@
<None Include="LocalizedPhrases-fr.xlf">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="LocalizedPhrases-sw.xlf">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="packages.config" />
<None Include="Properties\check-circle.png" />
</ItemGroup>
Expand Down
15 changes: 11 additions & 4 deletions Transcelerator/TxlLocalizationIncompleteViewModel.cs
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
// ---------------------------------------------------------------------------------------------
#region // Copyright (c) 2022, SIL International.
// <copyright from='2022' to='2022' company='SIL International'>
// Copyright (c) 2022, SIL International.
// ---------------------------------------------------------------------------------------------
#region // Copyright (c) 2024, SIL International.
// <copyright from='2022' to='2024' company='SIL International'>
// Copyright (c) 2024, SIL International.
//
// Distributable under the terms of the MIT License (http://sil.mit-license.org/)
// </copyright>
#endregion
// ---------------------------------------------------------------------------------------------
using System;
using System.Collections.Generic;
using L10NSharp;
using SIL.Windows.Forms.LocalizationIncompleteDlg;
using SIL.WritingSystems;
Expand All @@ -24,9 +25,15 @@ internal class TxlLocalizationIncompleteViewModel : LocalizationIncompleteViewMo

public override bool ShouldShowDialog(string languageId)
{
// If we have LocalizedQuestions for the language, even if none of the UI is localized,
// we should not show the dialog.
if (LocalesWithLocalizedQuestions.Contains(languageId))
return false;
if (languageId.StartsWith("en-"))
languageId = IetfLanguageTag.GetGeneralCode(languageId);
return base.ShouldShowDialog(languageId);
}

public List<string> LocalesWithLocalizedQuestions { get; set; }
}
}
3 changes: 1 addition & 2 deletions Transcelerator/TxlPlugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
using JetBrains.Annotations;
using Microsoft.Web.WebView2.Core;
using Paratext.PluginInterfaces;
using SIL.Windows.Forms.LocalizationIncompleteDlg;
using SIL.Reporting;
using SIL.WritingSystems;
using static System.Environment;
Expand All @@ -50,11 +49,11 @@ public class TxlPlugin : IParatextStandalonePlugin, IPluginErrorHandler
private static IProject s_currentProject;
private static IPluginHost Host { get; set; }

internal static TxlLocalizationIncompleteViewModel LocIncompleteViewModel { get; private set; }
internal static string InstallDir { get; }
internal static string ProgramDataFolder { get; }
internal static CoreWebView2Environment WebView2Environment { get; set; }

internal static LocalizationIncompleteViewModel LocIncompleteViewModel { get; private set; }
internal static ILocalizationManager PrimaryLocalizationManager => LocIncompleteViewModel.PrimaryLocalizationManager;

/// <summary>
Expand Down
19 changes: 16 additions & 3 deletions Transcelerator/UNSQuestionsDialog.cs
Original file line number Diff line number Diff line change
Expand Up @@ -615,13 +615,26 @@ private void AddAvailableLocalizationsToMenu()
{
var locales = LocalizationsFileAccessor
.GetAvailableLocales(InstallDir).Union(new[] { "en-US" }).ToList();
var languagesNeedingDistinctionByLocale = locales
.GroupBy(GetGeneralCode).Where(g => g.Count() > 1).Select(g => g.Key);

TxlPlugin.LocIncompleteViewModel.LocalesWithLocalizedQuestions = locales;

var localesByGeneralCode = locales.Select(GetGeneralCode).GroupBy(c => c).ToList();

// In addition to the languages that will be included by virtue of the existence
// of localized UI strings in a LocalizationManager, we also need to include specific
// variants (e.g., American vs. British English) where we distinguish those in our
// LocalizedPhrases files as well as any languages that have localized questions
// but no localized UI strings.
var additionalLocales = localesByGeneralCode.Where(g => g.Count() > 1)
.Select(g => g.Key)
.Union(localesByGeneralCode.Select(g => g.Key)
.Where(gc => !LocalizationManager.GetUILanguages(true)
.Any(l => l.IetfLanguageTag == gc)));

mnuDisplayLanguage.InitializeWithAvailableUILocales(HandleDisplayLanguageSelected,
PrimaryLocalizationManager, LocIncompleteViewModel,
ShowMoreUiLanguagesDlg,
locales.Where(l => languagesNeedingDistinctionByLocale.Contains(
locales.Where(l => additionalLocales.Contains(
GetGeneralCode(l))).ToDictionary(GetLanguageNameWithDetails, l => l));
}

Expand Down