1
0
mirror of https://github.com/mifi/lossless-cut.git synced 2024-11-22 02:12:30 +01:00

upgrade i18n packages

- this upgrades translation json format from v3 to 4
- replace i18next-scanner with i18next-parser (former doesn't support json v4)
- and enable pluralization support #346
This commit is contained in:
Mikael Finstad 2023-02-18 23:16:02 +08:00
parent d5744215e8
commit eb963ee601
No known key found for this signature in database
GPG Key ID: 25AB36E3E81CBC26
7 changed files with 839 additions and 294 deletions

View File

@ -1,30 +0,0 @@
// See also i18n.js
module.exports = {
input: ['src/**/*.{js,jsx}', 'public/*.js'],
output: './public',
options: {
sort: true,
// debug: true,
defaultLng: 'en',
func: {
list: ['i18next.t', 'i18n.t', 't'],
},
defaultValue: (lng, ns, key) => key,
resource: {
loadPath: 'locales/{{lng}}/{{ns}}.json',
savePath: 'locales/{{lng}}/{{ns}}.json',
jsonIndent: 4,
},
nsSeparator: false,
keySeparator: false,
pluralSeparator: false,
contextSeparator: false,
trans: {
fallbackKey: (ns, value) => value,
},
},
};

View File

@ -28,7 +28,7 @@
"version": "node script/postversion.mjs && git add no.mifi.losslesscut.appdata.xml",
"pack-linux": "electron-builder --linux",
"prepack-linux": "yarn build",
"scan-i18n": "i18next-scanner --config i18next-scanner.config.js",
"scan-i18n": "i18next --config i18next-parser.config.mjs",
"generate-licenses": "yarn licenses generate-disclaimer > licenses.txt && echo '\n\nffmpeg is licensed under GPL v2+:\n\nhttp://www.gnu.org/licenses/old-licenses/gpl-2.0.html' >> licenses.txt"
},
"author": {
@ -62,7 +62,7 @@
"evergreen-ui": "^6.13.1",
"fast-xml-parser": "^4.0.3",
"framer-motion": "^9.0.3",
"i18next-scanner": "^4.1.0",
"i18next-parser": "^7.6.0",
"icon-gen": "^3.0.0",
"ky": "^0.33.1",
"mkdirp": "^1.0.3",
@ -74,7 +74,7 @@
"pretty-bytes": "^6.0.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-i18next": "^11.3.3",
"react-i18next": "^12.1.5",
"react-icons": "^4.1.0",
"react-lottie-player": "^1.5.0",
"react-sortablejs": "^6.1.4",
@ -105,8 +105,8 @@
"file-url": "^3.0.0",
"fs-extra": "^8.1.0",
"github-api": "^3.2.2",
"i18next": "^19.8.5",
"i18next-fs-backend": "^1.0.1",
"i18next": "^22.4.10",
"i18next-fs-backend": "^2.1.1",
"json5": "^2.2.2",
"lodash": "^4.17.19",
"mime-types": "^2.1.14",

View File

@ -37,13 +37,11 @@ const commonI18nOptions = {
// updateMissing: isDev,
// saveMissingTo: 'all',
// Keep in sync between i18next-parser.config.js and i18n-common.js:
// TODO improve keys?
// Maybe do something like this: https://stackoverflow.com/a/19405314/6519037
// https://www.i18next.com/translation-function/context
keySeparator: false,
nsSeparator: false,
pluralSeparator: false,
contextSeparator: false,
};
const loadPath = (lng, ns) => getLangPath(`locales/${mapLang(lng)}/${ns}.json`);

View File

@ -14,7 +14,7 @@ i18n
// .use(LanguageDetector)
// init i18next
// for all options read: https://www.i18next.com/overview/configuration-options
// See also i18next-scanner.config.js
// See also i18next-parser.config.mjs
.init({
...commonI18nOptions,

View File

@ -1,6 +1,8 @@
{
"(data tracks such as GoPro GPS, telemetry etc. are not copied over by default because ffmpeg cannot cut them, thus they will cause the media duration to stay the same after cutting video/audio)": "(data tracks such as GoPro GPS, telemetry etc. are not copied over by default because ffmpeg cannot cut them, thus they will cause the media duration to stay the same after cutting video/audio)",
"(detected)": "(detected)",
"{{durationMsFormatted}} ms, {{frameCount}} frames": "{{durationMsFormatted}} ms, {{frameCount}} frames",
"{{selectedSegments}} of {{nonFilteredSegments}} segments selected": "{{selectedSegments}} of {{nonFilteredSegments}} segments selected",
"<0></0> <2></2> or <4>I</4> <6>O</6> to set cutpoints": "<0></0> <2></2> or <4>I</4> <6>O</6> to set cutpoints",
"A mismatch was detected in at least one file. You may proceed, but the resulting file might not be playable.": "A mismatch was detected in at least one file. You may proceed, but the resulting file might not be playable.",
"Abort": "Abort",
@ -33,6 +35,8 @@
"At least one resulting file name has no length": "At least one resulting file name has no length",
"At least one resulting file name is the same as the input path": "At least one resulting file name is the same as the input path",
"At least one resulting file will have a too long path": "At least one resulting file will have a too long path",
"attachment": "attachment",
"audio": "audio",
"Auto convert to supported format": "Auto convert to supported format",
"Auto load timecode": "Auto load timecode",
"Auto load timecode from file as an offset in the timeline?": "Auto load timecode from file as an offset in the timeline?",
@ -46,9 +50,6 @@
"Bind new key to action": "Bind new key to action",
"Bitrate": "Bitrate",
"Both": "Both",
"CSV files": "CSV files",
"CUE files": "CUE files",
"CUE sheet file": "CUE sheet file",
"Cancel": "Cancel",
"Capture every single frame as an image": "Capture every single frame as an image",
"Capture exactly one image every nth frame": "Capture exactly one image every nth frame",
@ -95,14 +96,17 @@
"Convert to supported format": "Convert to supported format",
"Converting to supported format": "Converting to supported format",
"Copy": "Copy",
"Copy to YouTube description/comment:": "Copy to YouTube description/comment:",
"Copy to clipboard": "Copy to clipboard",
"Copy to YouTube description/comment:": "Copy to YouTube description/comment:",
"Could not open media due to error {{errorCode}}": "Could not open media due to error {{errorCode}}",
"Create chapters from merged segments? (slow)": "Create chapters from merged segments? (slow)",
"Create fixed duration segments": "Create fixed duration segments",
"Create num segments": "Create num segments",
"Create random segments": "Create random segments",
"Create segments from keyframes": "Create segments from keyframes",
"CSV files": "CSV files",
"CUE files": "CUE files",
"CUE sheet file": "CUE sheet file",
"Current frame has been set as cover art": "Current frame has been set as cover art",
"Current setting": "Current setting",
"Current time": "Current time",
@ -114,9 +118,8 @@
"Cut mode is:": "Cut mode is:",
"Cut mode:": "Cut mode:",
"Cutpoints may be inaccurate.": "Cutpoints may be inaccurate.",
"DROP FILE(S)": "DROP FILE(S)",
"DaVinci Resolve / Final Cut Pro XML": "DaVinci Resolve / Final Cut Pro XML",
"Data": "Data",
"DaVinci Resolve / Final Cut Pro XML": "DaVinci Resolve / Final Cut Pro XML",
"Decrease audio volume": "Decrease audio volume",
"Decrease segment order": "Decrease segment order",
"Default": "Default",
@ -152,18 +155,19 @@
"Don't modify": "Don't modify",
"Done": "Done",
"Download {{version}}": "Download {{version}}",
"DROP FILE(S)": "DROP FILE(S)",
"Duration": "Duration",
"Duration has been fixed": "Duration has been fixed",
"EDL (MPlayer)": "EDL (MPlayer)",
"Edit": "Edit",
"Edit file metadata": "Edit file metadata",
"Edit track metadata": "Edit track metadata",
"Edit track {{trackNum}} metadata": "Edit track {{trackNum}} metadata",
"Edit track metadata": "Edit track metadata",
"Edit tracks / metadata tags": "Edit tracks / metadata tags",
"EDL (MPlayer)": "EDL (MPlayer)",
"Enable experimental ffmpeg features flag?": "Enable experimental ffmpeg features flag?",
"Enable HEVC / H265 hardware decoding (you may need to turn this off if you have problems with HEVC files)": "Enable HEVC / H265 hardware decoding (you may need to turn this off if you have problems with HEVC files)",
"Enable HEVC hardware decoding": "Enable HEVC hardware decoding",
"Enable MOV Faststart?": "Enable MOV Faststart?",
"Enable experimental ffmpeg features flag?": "Enable experimental ffmpeg features flag?",
"Enable this to allow faster playback of the resulting file. This may cause processing to take a little longer": "Enable this to allow faster playback of the resulting file. This may cause processing to take a little longer",
"Enables shifting when required by the target format.": "Enables shifting when required by the target format.",
"End": "End",
@ -179,6 +183,7 @@
"Experimental flag": "Experimental flag",
"Experimental functionality has been activated!": "Experimental functionality has been activated!",
"Export": "Export",
"Export {{ num }} segments": "Export {{ num }} segments",
"Export each track as individual files": "Export each track as individual files",
"Export finished with warning(s)": "Export finished with warning(s)",
"Export is done!": "Export is done!",
@ -191,7 +196,6 @@
"Export segment(s)": "Export segment(s)",
"Export selection": "Export selection",
"Export to separate files": "Export to separate files",
"Export {{ num }} segments": "Export {{ num }} segments",
"Export+merge": "Export+merge",
"Exporting": "Exporting",
"Extract": "Extract",
@ -201,14 +205,11 @@
"Extract frames of the selected segment as images?": "Extract frames of the selected segment as images?",
"Extract this track as file": "Extract this track as file",
"Extract unprocessable tracks to separate files or discard them?": "Extract unprocessable tracks to separate files or discard them?",
"Extracting {{numTracks}} unprocessable tracks(s)": "Extracting {{numTracks}} unprocessable tracks(s)",
"Extracting all streams": "Extracting all streams",
"Extracting frames": "Extracting frames",
"Extracting track": "Extracting track",
"Extracting {{numTracks}} unprocessable tracks(s)": "Extracting {{numTracks}} unprocessable tracks(s)",
"Extraneous track {{index}}": "Extraneous track {{index}}",
"FAQ": "FAQ",
"FCPXML files": "FCPXML files",
"FFmpeg": "FFmpeg",
"Failed to batch convert to supported format": "Failed to batch convert to supported format",
"Failed to capture frame": "Failed to capture frame",
"Failed to convert file. Try a different conversion": "Failed to convert file. Try a different conversion",
@ -225,12 +226,15 @@
"Failed to fix file duration": "Failed to fix file duration",
"Failed to load segments": "Failed to load segments",
"Failed to open file": "Failed to open file",
"FAQ": "FAQ",
"Fast: Full quality remux (no audio), likely to fail": "Fast: Full quality remux (no audio), likely to fail",
"Fast: Full quality remux, likely to fail": "Fast: Full quality remux, likely to fail",
"Fast: Remux video, encode audio (fails if unsupported video codec)": "Fast: Remux video, encode audio (fails if unsupported video codec)",
"Fastest: Low playback speed": "Fastest: Low playback speed",
"Fastest: Low playback speed (audio remux), likely to fail": "Fastest: Low playback speed (audio remux), likely to fail",
"Fastest: Low playback speed (no audio)": "Fastest: Low playback speed (no audio)",
"FCPXML files": "FCPXML files",
"FFmpeg": "FFmpeg",
"File": "File",
"File compatibility check is not enabled, so the merge operation might not produce a valid output. Enable \"Check compatibility\" below to check file compatibility before merging.": "File compatibility check is not enabled, so the merge operation might not produce a valid output. Enable \"Check compatibility\" below to check file compatibility before merging.",
"File info": "File info",
@ -251,11 +255,11 @@
"Frame numbers (CSV)": "Frame numbers (CSV)",
"Frame timestamp": "Frame timestamp",
"Frames extracted to: {{path}}": "Frames extracted to: {{path}}",
"HTML video tag": "HTML video tag",
"Help": "Help",
"Hide informational notifications?": "Hide informational notifications?",
"Hover mouse over buttons in the main interface to see which function they have": "Hover mouse over buttons in the main interface to see which function they have",
"How to use": "How to use",
"HTML video tag": "HTML video tag",
"If nothing helps, you can send an <1>Error report</1>": "If nothing helps, you can send an <1>Error report</1>",
"If output does not look right, see the Help menu.": "If output does not look right, see the Help menu.",
"If this is checked, all audio/video/subtitle/data tracks will be included. This may not always work for all file types. If not checked, only default streams will be included.": "If this is checked, all audio/video/subtitle/data tracks will be included. This may not always work for all file types. If not checked, only default streams will be included.",
@ -273,10 +277,10 @@
"Increase segment order": "Increase segment order",
"Input has {{numStreamsTotal}} tracks - <3>Keeping {{numStreamsToCopy}} tracks</3>": "Input has {{numStreamsTotal}} tracks - <3>Keeping {{numStreamsToCopy}} tracks</3>",
"Instead of video apparently starting at 0, you can offset by a specified value. This only applies to the preview inside LosslessCut and does not modify the file in any way. (Useful for viewing/cutting videos according to timecodes)": "Instead of video apparently starting at 0, you can offset by a specified value. This only applies to the preview inside LosslessCut and does not modify the file in any way. (Useful for viewing/cutting videos according to timecodes)",
"Invalid EDL data found": "Invalid EDL data found",
"Invalid JSON": "Invalid JSON",
"Invalid character(s) found in key": "Invalid character(s) found in key",
"Invalid EDL data found": "Invalid EDL data found",
"Invalid input": "Invalid input",
"Invalid JSON": "Invalid JSON",
"Invalid number entered": "Invalid number entered",
"Invalid start or end value. Must contain a number of seconds": "Invalid start or end value. Must contain a number of seconds",
"Invert all segments on timeline": "Invert all segments on timeline",
@ -324,15 +328,14 @@
"Loop current segment": "Loop current segment",
"Lossless rotation might not work with this file format. You may try changing to MP4": "Lossless rotation might not work with this file format. You may try changing to MP4",
"LosslessCut project": "LosslessCut project",
"MPlayer EDL": "MPlayer EDL",
"Make sure you have no overlapping segments.": "Make sure you have no overlapping segments.",
"Manually input current segment's end time": "Manually input current segment's end time",
"Manually input current segment's start time": "Manually input current segment's start time",
"Max length": "Max length",
"Merge {{segments}} cut segments to one file?": "Merge {{segments}} cut segments to one file?",
"Merge & Separate": "Merge & Separate",
"Merge cuts": "Merge cuts",
"Merge options": "Merge options",
"Merge {{segments}} cut segments to one file?": "Merge {{segments}} cut segments to one file?",
"Merge!": "Merge!",
"Merge/concatenate files": "Merge/concatenate files",
"Merge/concatenate with current file": "Merge/concatenate with current file",
@ -344,6 +347,7 @@
"Mouse scroll/wheel left/right": "Mouse scroll/wheel left/right",
"Mouse scroll/wheel up/down": "Mouse scroll/wheel up/down",
"Mouse wheel zoom modifier key": "Mouse wheel zoom modifier key",
"MPlayer EDL": "MPlayer EDL",
"Mute preview? (will not affect output)": "Mute preview? (will not affect output)",
"Nearest keyframe": "Nearest keyframe",
"New version!": "New version!",
@ -385,11 +389,11 @@
"Output name(s):": "Output name(s):",
"Overwrite existing files": "Overwrite existing files",
"Overwrite files when exporting, if a file with the same name as the output file name exists?": "Overwrite files when exporting, if a file with the same name as the output file name exists?",
"PBF files": "PBF files",
"Pan timeline": "Pan timeline",
"Paste": "Paste",
"Paste or type a YouTube chapters description or textual chapter description": "Paste or type a YouTube chapters description or textual chapter description",
"Pause": "Pause",
"PBF files": "PBF files",
"Permanently delete": "Permanently delete",
"Permanently delete the files if trash fails?": "Permanently delete the files if trash fails?",
"Play": "Play",
@ -452,8 +456,8 @@
"Segments and cut points": "Segments and cut points",
"Segments to export:": "Segments to export:",
"Segments total:": "Segments total:",
"Select All": "Select All",
"Select a different output <1>Format</1> (<3>matroska</3> and <5>mp4</5> support most codecs)": "Select a different output <1>Format</1> (<3>matroska</3> and <5>mp4</5> support most codecs)",
"Select All": "Select All",
"Select all segments": "Select all segments",
"Select custom FFmpeg directory": "Select custom FFmpeg directory",
"Select next segment": "Select next segment",
@ -516,9 +520,9 @@
"Store in working directory": "Store in working directory",
"Store next to media file": "Store next to media file",
"Store project file (.llc) in the working directory or next to loaded media file?": "Store project file (.llc) in the working directory or next to loaded media file?",
"subtitle": "subtitle",
"Subtitle": "Subtitle",
"System language": "System language",
"TXT files": "TXT files",
"Text chapters / YouTube": "Text chapters / YouTube",
"The audio track is not supported. You can convert to a supported format from the menu": "The audio track is not supported. You can convert to a supported format from the menu",
"The file name template is missing {{ext}} and will result in a file without the suggested extension. This may result in an unplayable output file.": "The file name template is missing {{ext}} and will result in a file without the suggested extension. This may result in an unplayable output file.",
@ -537,6 +541,7 @@
"This file does not have a valid duration. This may cause issues. You can try to fix the file's duration from the File menu": "This file does not have a valid duration. This may cause issues. You can try to fix the file's duration from the File menu",
"This file has embedded chapters. Do you want to import the chapters as cut-segments?": "This file has embedded chapters. Do you want to import the chapters as cut-segments?",
"This is where working files and exported files are stored.": "This is where working files and exported files are stored.",
"thumbnail": "thumbnail",
"Timeline keyboard seek acceleration": "Timeline keyboard seek acceleration",
"Timeline keyboard seek speed": "Timeline keyboard seek speed",
"Timeline trackpad/wheel sensitivity": "Timeline trackpad/wheel sensitivity",
@ -544,15 +549,17 @@
"Times in seconds (CSV)": "Times in seconds (CSV)",
"Timestamps (CSV)": "Timestamps (CSV)",
"Timestamps (TSV/TXT)": "Timestamps (TSV/TXT)",
"Toggle Developer Tools": "Toggle Developer Tools",
"Toggle Full Screen": "Toggle Full Screen",
"to show advanced view": "to show advanced view",
"to show simple view": "to show simple view",
"Toggle advanced view": "Toggle advanced view",
"Toggle current segment selected": "Toggle current segment selected",
"Toggle Developer Tools": "Toggle Developer Tools",
"Toggle Full Screen": "Toggle Full Screen",
"Toggle zoom between 1x and a calculated comfortable zoom level": "Toggle zoom between 1x and a calculated comfortable zoom level",
"Tools": "Tools",
"Track has been extracted": "Track has been extracted",
"Track {{index}} mismatch: {{key1}} {{value1}} != {{value2}}": "Track {{index}} mismatch: {{key1}} {{value1}} != {{value2}}",
"Track {{num}} info": "Track {{num}} info",
"Track has been extracted": "Track has been extracted",
"Tracks": "Tracks",
"Trash auto-generated files": "Trash auto-generated files",
"Trash original source file": "Trash original source file",
@ -564,6 +571,7 @@
"Try one of the following before exporting again:": "Try one of the following before exporting again:",
"Try to automatically convert to supported format when opening unsupported file?": "Try to automatically convert to supported format when opening unsupported file?",
"Try with a <1>Different file</1>": "Try with a <1>Different file</1>",
"TXT files": "TXT files",
"Unable to change playback rate right now": "Unable to change playback rate right now",
"Unable to delete file: {{message}}": "Unable to delete file: {{message}}",
"Unable to export this file": "Unable to export this file",
@ -582,6 +590,7 @@
"Using external ffmpeg": "Using external ffmpeg",
"Variables": "Variables",
"Version": "Version",
"video": "video",
"Video FPS": "Video FPS",
"View": "View",
"View and edit segment tags in JSON5 format:": "View and edit segment tags in JSON5 format:",
@ -610,7 +619,7 @@
"You are running version {{version}}": "You are running version {{version}}",
"You can customize the file name of the output segment(s) using special variables.": "You can customize the file name of the output segment(s) using special variables.",
"You do not have permission to access this file": "You do not have permission to access this file",
"You have enabled the \"invert segments\" mode <1></1> which will cut away selected segments instead of keeping them. But there is no space between any segments, or at least two segments are overlapping. This would not produce any output. Either make room between segments or click the Yinyang <3></3> symbol below to disable this mode. Alternatively you may combine overlapping segments from the menu.": "You have enabled the \"invert segments\" mode <1></1> which will cut away selected segments instead of keeping them. But there is no space between any segments, or at least two segments are overlapping. This would not produce any output. Either make room between segments or click the Yinyang <3></3> symbol below to disable this mode. Alternatively you may combine overlapping segments from the menu.",
"You have enabled the &quot;invert segments&quot; mode <1></1> which will cut away selected segments instead of keeping them. But there is no space between any segments, or at least two segments are overlapping. This would not produce any output. Either make room between segments or click the Yinyang <3></3> symbol below to disable this mode. Alternatively you may combine overlapping segments from the menu.": "You have enabled the &quot;invert segments&quot; mode <1></1> which will cut away selected segments instead of keeping them. But there is no space between any segments, or at least two segments are overlapping. This would not produce any output. Either make room between segments or click the Yinyang <3></3> symbol below to disable this mode. Alternatively you may combine overlapping segments from the menu.",
"You have no write access to the directory of this file": "You have no write access to the directory of this file",
"You have no write access to the directory of this file, please select a custom working dir": "You have no write access to the directory of this file, please select a custom working dir",
"You might want to redact any sensitive information like paths.": "You might want to redact any sensitive information like paths.",
@ -624,14 +633,5 @@
"Zoom in more to view waveform": "Zoom in more to view waveform",
"Zoom in timeline": "Zoom in timeline",
"Zoom in/out timeline": "Zoom in/out timeline",
"Zoom out timeline": "Zoom out timeline",
"attachment": "attachment",
"audio": "audio",
"subtitle": "subtitle",
"thumbnail": "thumbnail",
"to show advanced view": "to show advanced view",
"to show simple view": "to show simple view",
"video": "video",
"{{durationMsFormatted}} ms, {{frameCount}} frames": "{{durationMsFormatted}} ms, {{frameCount}} frames",
"{{selectedSegments}} of {{nonFilteredSegments}} segments selected": "{{selectedSegments}} of {{nonFilteredSegments}} segments selected"
"Zoom out timeline": "Zoom out timeline"
}

View File

@ -9,6 +9,7 @@ const { commonI18nOptions, fallbackLng, loadPath, addPath } = remote.require('./
export { fallbackLng };
// https://github.com/i18next/react-i18next/blob/master/example/react/src/i18n.js
// https://github.com/i18next/i18next/issues/869
i18n
.use(Backend)
@ -20,7 +21,7 @@ i18n
.use(initReactI18next)
// init i18next
// for all options read: https://www.i18next.com/overview/configuration-options
// See also i18next-scanner.config.js
// See also i18next-parser.config.mjs
.init({
...commonI18nOptions,

1012
yarn.lock

File diff suppressed because it is too large Load Diff