mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
add a argument for i18n to enable csv generation
This commit is contained in:
parent
c8db3e3d95
commit
c9c32eea65
@ -291,6 +291,7 @@ fn test_localization_directory(
|
||||
ref_manifest: &Path,
|
||||
i18n_references: &HashMap<String, LocalizationEntryState>,
|
||||
be_verbose: bool,
|
||||
csv_enabled: bool,
|
||||
repo: &git2::Repository,
|
||||
head_ref: &git2::Reference,
|
||||
) -> Option<LocalizationStats> {
|
||||
@ -494,11 +495,14 @@ fn print_translation_stats(
|
||||
/// `root_dir` - absolute path to main repo
|
||||
/// `assets_path` - relative path to asset directory (right now it is
|
||||
/// 'assets/voxygen/i18n')
|
||||
/// be_verbose -
|
||||
/// csv_enabled - generate csv files in target folder
|
||||
pub fn test_specific_localization(
|
||||
code: &str,
|
||||
root_dir: &Path,
|
||||
assets_path: &Path,
|
||||
be_verbose: bool,
|
||||
csv_enabled: bool,
|
||||
) {
|
||||
// Relative paths from root of repo to assets
|
||||
let ref_lang_dir = assets_path.join(REFERENCE_LANG);
|
||||
@ -533,6 +537,7 @@ pub fn test_specific_localization(
|
||||
&ref_manifest,
|
||||
&reference_i18n,
|
||||
be_verbose,
|
||||
csv_enabled,
|
||||
&repo,
|
||||
&head_ref,
|
||||
);
|
||||
@ -542,7 +547,8 @@ pub fn test_specific_localization(
|
||||
/// `root_dir` - absolute path to main repo
|
||||
/// `assets_path` - relative path to asset directory (right now it is
|
||||
/// 'assets/voxygen/i18n')
|
||||
pub fn test_all_localizations(root_dir: &Path, assets_path: &Path, be_verbose: bool) {
|
||||
/// csv_enabled - generate csv files in target folder
|
||||
pub fn test_all_localizations(root_dir: &Path, assets_path: &Path, be_verbose: bool, csv_enabled: bool) {
|
||||
let ref_lang_dir = assets_path.join(REFERENCE_LANG);
|
||||
let ref_manifest = ref_lang_dir.join(LANG_MANIFEST_FILE.to_string() + ".ron");
|
||||
|
||||
@ -585,6 +591,7 @@ pub fn test_all_localizations(root_dir: &Path, assets_path: &Path, be_verbose: b
|
||||
&ref_manifest,
|
||||
&reference_i18n,
|
||||
be_verbose,
|
||||
csv_enabled,
|
||||
&repo,
|
||||
&head_ref,
|
||||
);
|
||||
|
@ -28,11 +28,17 @@ fn main() {
|
||||
.long("verbose")
|
||||
.help("print additional information"),
|
||||
)
|
||||
.arg(
|
||||
Arg::with_name("csv")
|
||||
.long("csv")
|
||||
.help("generate csv files per language in target folder"),
|
||||
)
|
||||
.get_matches();
|
||||
|
||||
// Generate paths
|
||||
let root = common_assets::find_root().expect("Failed to find root of repository");
|
||||
let asset_path = Path::new("assets/voxygen/i18n/");
|
||||
let csv_enabled = matches.is_present("csv");
|
||||
|
||||
if let Some(code) = matches.value_of("CODE") {
|
||||
analysis::test_specific_localization(
|
||||
@ -40,10 +46,11 @@ fn main() {
|
||||
&root,
|
||||
&asset_path,
|
||||
matches.is_present("verbose"),
|
||||
csv_enabled,
|
||||
);
|
||||
}
|
||||
if matches.is_present("test") {
|
||||
analysis::test_all_localizations(&root, &asset_path, matches.is_present("verbose"));
|
||||
analysis::test_all_localizations(&root, &asset_path, matches.is_present("verbose"), csv_enabled);
|
||||
}
|
||||
if matches.is_present("verify") {
|
||||
verification::verify_all_localizations(&root, &asset_path);
|
||||
|
Loading…
Reference in New Issue
Block a user