Skip to content

Commit

Permalink
auto language
Browse files Browse the repository at this point in the history
  • Loading branch information
Anime4000 committed Jul 9, 2024
1 parent 3b04e35 commit cbde19f
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
11 changes: 11 additions & 0 deletions IFME/Language.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,5 +52,16 @@ public static string FromFileNameCode(string filePath)
var file = Path.GetFileNameWithoutExtension(filePath);
return TryParseCode(file.Substring(file.Length - 3));
}

public static string FromFileNameCode(string filePath, object lastChoice)
{
var file = Path.GetFileNameWithoutExtension(filePath);
var lang = TryParseCode(file.Substring(file.Length - 3));

if (string.Equals(lang, "und"))
return lastChoice.ToString();

return lang;
}
}
}
2 changes: 1 addition & 1 deletion IFME/frmMain.Function.cs
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ private void MediaSubtitleListAdd(string path)
Enable = true,
FilePath = path,
Id = id,
Lang = "und",
Lang = Language.FromFileNameCode(path, cboSubLang.SelectedValue),
Codec = string.Empty
});
}
Expand Down
1 change: 1 addition & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
Version 8.3.4 (Celestial Rhapsody)
----------------------------------
[Fixed] Check Queue Consistency code cause invalid index crash, such old code is removed
[Fixed] When add subtitle, it will use selected language if language code in file name not found

Version 8.3.3 (Luminous Veil)
-----------------------------
Expand Down

0 comments on commit cbde19f

Please sign in to comment.