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: