mirror of
https://github.com/keymanapp/keyman.git
synced 2026-09-24 08:37:42 +00:00
fix(windows): Adjust to new version of langtags.json
The new version of `langtags.json` added a new `_conformance` record at the top of the file. This change adjusts the indexes where we expect the `_version` record. It also introduces a const for the index of the version record to make future updates easier.
This commit is contained in:
parent
88c2e1a4f2
commit
f095593cd5
1 changed files with 8 additions and 4 deletions
|
|
@ -7,6 +7,10 @@ type
|
|||
class procedure Build(const LangTagsFile, DestinationFile: string);
|
||||
end;
|
||||
|
||||
const
|
||||
{ Index of the _version record in the langtags.json file }
|
||||
IndexOfVersionRecord = 3;
|
||||
|
||||
implementation
|
||||
|
||||
uses
|
||||
|
|
@ -85,7 +89,7 @@ begin
|
|||
end;
|
||||
|
||||
try
|
||||
for i := 0 to 2 do
|
||||
for i := 0 to IndexOfVersionRecord do
|
||||
begin
|
||||
if (FLangTags.Items[i] as TJSONObject).Values['tag'].Value = '_version' then
|
||||
begin
|
||||
|
|
@ -153,11 +157,11 @@ begin
|
|||
FResult.Add('');
|
||||
FResult.Add('{ TLangTagsMap }');
|
||||
FResult.Add('');
|
||||
FResult.Add(Format('const CLangTags: array[0..%d] of TLangTag = (', [FLangTags.Count - 4]));
|
||||
FResult.Add(Format('const CLangTags: array[0..%d] of TLangTag = (', [FLangTags.Count - IndexOfVersionRecord - 2]));
|
||||
|
||||
comma := ',';
|
||||
FTagMapCount := 0;
|
||||
for i := 3 to FLangTags.Count - 1 do
|
||||
for i := IndexOfVersionRecord + 1 to FLangTags.Count - 1 do
|
||||
begin
|
||||
if i = FLangTags.Count - 1 then comma := '';
|
||||
FLangTag := FLangTags.Items[i] as TJSONObject;
|
||||
|
|
@ -194,7 +198,7 @@ begin
|
|||
FResult.Add(Format('const CAllTags: array[0..%d] of TStringMap = (', [FTagMapCount-1]));
|
||||
|
||||
comma := '';
|
||||
for i := 3 to FLangTags.Count - 1 do
|
||||
for i := IndexOfVersionRecord + 1 to FLangTags.Count - 1 do
|
||||
begin
|
||||
FLangTag := FLangTags.Items[i] as TJSONObject;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue