Skip to content
Open
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).

### Fixed

- [SIL.LCModel] `CreateNewLangProj` no longer throws when no anthropology list file is passed and the default analysis writing system's ICU locale differs from its language tag (e.g. `pt-BR`)
- [SIL.LCModel] BaseStyleInfo now loads default font features (ktptFontVariations) from style rules, fixing font features set as style defaults being dropped on reload (LT-22351)
- [SIL.LCModel] BaseStyleInfo no longer clobbers ws-specific font overrides inherited from a based-on style with the default font info's merely-inherited values; only explicitly-set default properties are propagated to ws overrides (LT-22351)
- [SIL.LCModel] BulletInfo now decodes all properties of an encoded bullet font info instead of stopping at the first string property, fixing bullet font features (ktptFontVariations) being lost when a bullet font name was also set (LT-22351)
Expand Down
2 changes: 1 addition & 1 deletion src/SIL.LCModel/LcmCache.cs
Original file line number Diff line number Diff line change
Expand Up @@ -472,7 +472,7 @@ public static string CreateNewLangProj(IThreadedProgress progressDlg, params obj

cache.ActionHandlerAccessor.BeginNonUndoableTask();
InitializeAnthroList(cache.LangProject,
cache.WritingSystemFactory.GetWsFromStr(analWrtSys != null ? analWrtSys.IcuLocale : userIcuLocale),
cache.WritingSystemFactory.GetWsFromStr(analWrtSys != null ? analWrtSys.Id : userIcuLocale),
(parameters.Length > 8) ? (string) parameters[8] : null);
ImportLocalizedLists(cache, dirs.TemplateDirectory, progressDlg);
cache.ActionHandlerAccessor.EndNonUndoableTask();
Expand Down
34 changes: 34 additions & 0 deletions tests/SIL.LCModel.Tests/LcmCacheTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,40 @@ public void CreateNewLangProject_AnthropologyCategoriesExist()
}
}

/// <summary>
/// The empty Anthropology Categories list is named in the default analysis writing system. That must work
/// when the writing system's ICU locale differs from its language tag ("pt_BR" vs "pt-BR").
/// </summary>
[Test]
public void CreateNewLangProject_DefaultAnalysisWsWithIcuLocaleDifferentFromTag()
{
const string dbName = "AnthroListPtBrTest";
SureRemoveDb(dbName);
var preExistingDirs = new List<string>(Directory.GetDirectories(m_projectsDirectory));
try
{
var analWs = new CoreWritingSystemDefinition("pt-BR") { Id = "pt-BR" };
Assert.AreNotEqual(analWs.LanguageTag, analWs.IcuLocale, "Test setup: the tag and ICU locale should differ");
string dbFileName = LcmCache.CreateNewLangProj(new DummyProgressDlg(), dbName, m_lcmDirectories,
new SingleThreadedSynchronizeInvoke(), analWs, new CoreWritingSystemDefinition("fr") { Id = "fr" }, "en",
new HashSet<CoreWritingSystemDefinition>(), new HashSet<CoreWritingSystemDefinition>(), null);

var projectId = new TestProjectId(BackendProviderType.kXMLWithMemoryOnlyWsMgr, dbFileName);
using (var cache = LcmCache.CreateCacheFromExistingData(projectId, "en", m_ui, m_lcmDirectories, new LcmSettings(),
new DummyProgressDlg()))
{
var ptBr = cache.ServiceLocator.WritingSystemManager.Get("pt-BR");
Assert.AreEqual(ptBr, cache.LangProject.DefaultAnalysisWritingSystem);
Assert.AreEqual(Strings.ksAnthropologyCategories, cache.LangProject.AnthroListOA.Name.get_String(ptBr.Handle).Text);
Assert.AreEqual(Strings.ksAnth, cache.LangProject.AnthroListOA.Abbreviation.get_String(ptBr.Handle).Text);
}
}
finally
{
RemoveTestDirs(preExistingDirs, Directory.GetDirectories(m_projectsDirectory));
}
}

#region Private helper methods
/// <summary>
/// Removes a FW DB directory, and ensures the location is promptly available for reuse
Expand Down
Loading