Localazy CLI Tips: Filter keys when uploading

Sometimes, you don't want to upload all your texts with the Localazy CLI upload command. Why? There are several reasons:

  • texts that you simply don't want to translate (e.g., English only information or texts available only in one language)
  • sensitive texts (internal IDs, ad ID, internal links)
  • texts that are not supposed to be translated (URLs, numbers, names)

You can place those texts in a separate file, but that could complicate your workflow, and it's not always possible. For example, if you generate files from the source code using string extractors, you have no choice.

Fortunately, Localazy is here to help you with this!

When uploading your files, you can specify rules used for including or excluding keys:

{
	"upload": {
		"type": "json",
		"excludeKeys": [
			"prefix:private_",
			"match:internal_ad_identifier",
			"regex:.*_private_.*"
		]
	}
	// ...
}

The file will be uploaded, parsed, and all text matching my rules above will be skipped during the import process.

πŸ“• Rules

You can match your keys using several different rules:

  • prefix
  • suffix
  • exact match
  • containing substring
  • regular expression

Also, you can decide whether you want to include all keys, Β just exclude some of them, or whether you want only to include selected keys. It's also possible to match structured keys.

Read more about string keys in the documentation.

πŸ’– You might also like

Read more articles related to Localazy CLI on our blog.

πŸ“š Further reading:


This is a companion discussion topic for the original entry at https://localazy.com/blog/localazy-cli-tips-filter-keys-when-uploading