Skip to content
Merged
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
3 changes: 3 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# remove trailing whitespace
[*]
trim_trailing_whitespace = true
29 changes: 29 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,4 @@ serde_json = "1.0.140"
directories = "6.0.0"
ureq = "3.0.11"
polib = { git = "https://github.com/BrettDong/polib.git", rev = "a8b7616" }
walkdir = "2.5.0"
13 changes: 13 additions & 0 deletions src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,15 @@ pub enum Commands {
#[arg(short, long, default_value = "linuxdeepin")]
organization_slug: String,
},
#[command(name = "gentxyaml")]
#[command(
about = "Generate transifex.yaml by scanning translation files in the repository",
long_about = "Scan the repository for translation files (.ts and .po) and generate a corresponding transifex.yaml configuration file.\n\n\
This is useful for new projects that don't have any existing configuration files.",
)]
GenTxYaml {
project_root: PathBuf,
},
}

#[derive(TeError, Debug)]
Expand All @@ -119,6 +128,7 @@ pub enum CliError {
Statistics(#[from] crate::subcmd::statistics::CmdError),
Yaml2TxConfig(#[from] crate::subcmd::yaml2txconfig::CmdError),
TxConfig2Yaml(#[from] crate::subcmd::txconfig2yaml::CmdError),
GenTxYaml(#[from] crate::subcmd::gentxyaml::CmdError),
}

pub fn execute() -> Result<(), CliError> {
Expand All @@ -144,6 +154,9 @@ pub fn execute() -> Result<(), CliError> {
Commands::MonoTxConfig { project_root, force_online, organization_slug } => {
subcmd::subcmd_monotxconfig(&project_root, force_online, organization_slug);
},
Commands::GenTxYaml { project_root } => {
subcmd::subcmd_gentxyaml(&project_root)?;
},
}

Ok(())
Expand Down
2 changes: 2 additions & 0 deletions src/subcmd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,11 @@ pub mod statistics;
pub mod yaml2txconfig;
pub mod txconfig2yaml;
pub mod monotxconfig;
pub mod gentxyaml;

pub use self::zhconv::{subcmd_zhconv, subcmd_zhconv_plain};
pub use statistics::subcmd_statistics;
pub use yaml2txconfig::{subcmd_yaml2txconfig, create_linked_resources_table};
pub use txconfig2yaml::subcmd_txconfig2yaml;
pub use monotxconfig::subcmd_monotxconfig;
pub use gentxyaml::subcmd_gentxyaml;
Loading