Child pages
  • [deployment] Collect information about language pack importing
Skip to end of metadata
Go to start of metadata

Right you can import language pack, but there no detailed information shown about actual phrases/e-mail templates that were added/changed/deleted in the process. Maybe this information isn't that important to average website administrator, however it's invaluable for Deployment Script.

Sometimes, while working with Deployment Script, I see situations where phrases are reported as being deleted locally, but I'm sure I wasn't deleting anything. It all ends with fact, that some part of /modules/custom/install/english.lang file wasn't imported. Without import log this is pretty hard to analyze later on.

There are 2 use cases at least, where it will be used:

  • deployment script
  • direct language pack import from "Regional" section

Because of it we need to make sure, that logging format isn't hardcoded within language importing code. To implement that we need to:

  1. create ILanguagePackImportListener interface
  2. create single class per each use case (2 classes for now), that would implement this interface
  3. add LanguagePackImportHelper::setListener method, that would allow for listener to be set
  4. each add/change/delete operation would be reported to a listener (see example below)
{
	'language': 'English',
	'language_id': '1',
	'item_type': 'phrase',
	'item_key': 'LA_TEST_LABEL',
	'action_type': 'added'
}

Also it would be wise to replace any reporting text, that is the same each time with class named constants.