-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added setting of default base point on maps depending on user locale
- Loading branch information
1 parent
40e26d5
commit abd6a56
Showing
16 changed files
with
190 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
--- | ||
- Locale: 'af-ZA' | ||
MapBasePoint: 'South Africa, Pretoria' | ||
- Locale: 'be-BY' | ||
MapBasePoint: 'Беларусь, Мінск' | ||
- Locale: 'cs-CZ' | ||
MapBasePoint: 'Czechia, Prague' | ||
- Locale: 'es-ES' | ||
MapBasePoint: 'Spain, Madrid' | ||
- Locale: 'hu-HU' | ||
MapBasePoint: 'Hungary, Budapest' | ||
- Locale: 'is-IS' | ||
MapBasePoint: 'Iceland, Reykjavík' | ||
- Locale: 'it-IT' | ||
MapBasePoint: 'Italy, Rome' | ||
- Locale: 'ja-JP' | ||
MapBasePoint: 'Japan, Tokyo' | ||
- Locale: 'kk-KZ' | ||
MapBasePoint: 'Kazakhstan, Astana' | ||
- Locale: 'nl-NL' | ||
MapBasePoint: 'Netherlands, Amsterdam' | ||
- Locale: 'pt-PT' | ||
MapBasePoint: 'Portugal, Lisbon' | ||
- Locale: 'ru-RU' | ||
MapBasePoint: 'Российская Федерация, Москва' | ||
- Locale: 'sr-Latn-RS' | ||
MapBasePoint: 'Serbia, Belgrade' | ||
- Locale: 'zh-CN' | ||
MapBasePoint: 'China, Beijing' | ||
... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
/* | ||
* "GEDKeeper", the personal genealogical database editor. | ||
* Copyright (C) 2009-2024 by Sergey V. Zhdanovskih. | ||
* | ||
* This file is part of "GEDKeeper". | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
using System; | ||
using System.IO; | ||
using System.Linq; | ||
|
||
namespace GKCore | ||
{ | ||
public sealed class LocaleInfo | ||
{ | ||
public string Locale; | ||
public string MapBasePoint; | ||
} | ||
|
||
|
||
/// <summary> | ||
/// | ||
/// </summary> | ||
public sealed class LocalesCollection | ||
{ | ||
private LocaleInfo[] fList; | ||
|
||
public LocalesCollection() | ||
{ | ||
fList = new LocaleInfo[0]; | ||
} | ||
|
||
public void Load(string fileName) | ||
{ | ||
if (!File.Exists(fileName)) | ||
return; | ||
|
||
try { | ||
using (var reader = new StreamReader(fileName)) { | ||
string content = reader.ReadToEnd(); | ||
fList = YamlHelper.Deserialize<LocaleInfo[]>(content); | ||
} | ||
} catch (Exception ex) { | ||
Logger.WriteError("LocalesCollection.Load()", ex); | ||
} | ||
} | ||
|
||
public string GetMapBasePoint(string locale) | ||
{ | ||
var locInfo = fList.FirstOrDefault((x) => x.Locale == locale); | ||
return (locInfo == null) ? null : locInfo.MapBasePoint; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.