From 8487fa6248d1d5dac81640de9c55c1eab9f324b3 Mon Sep 17 00:00:00 2001 From: Marien Fressinaud Date: Fri, 15 May 2020 17:31:21 +0200 Subject: Reformat i18n correctly (#2976) * Ignore i18n gen.dir key * Add a makefile target to update an i18n key * Mark some i18n keys to ignore * Reformat i18n files correctly * Make i18n keys sort case-sensitive Calling `make i18n-format` was always inverting 4 lines: - gen.date.dec with gen.date.Dec - and gen.date.nov with gen.date.Nov I don't know why these particular lines and not the others, but it appeared the sort function was case insensitive due to the `SORT_FLAG_CASE` flag passed to the `ksort` function. Removing this flag makes the calls to the formatter idempotent and more reliable. Unfortunately it moves a lot of lines since the `_` character is considered differently. * Check i18n files are correctly formatted on Travis --- Makefile | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'Makefile') diff --git a/Makefile b/Makefile index fe5043301..ee5551916 100644 --- a/Makefile +++ b/Makefile @@ -102,6 +102,20 @@ endif @$(PHP) ./cli/manipulate.translation.php -a delete -k $(key) @echo Key removed. +.PHONY: i18n-update-key +i18n-update-key: ## Update a translation key in all supported languages +ifndef key + @echo To update a key, you need to provide one in the "key" variable. + @exit 10 +endif +ifndef value + @echo To update a key, you need to provide its value in the "value" variable. + @exit 10 +endif + @$(PHP) ./cli/manipulate.translation.php -a delete -k $(key) + @$(PHP) ./cli/manipulate.translation.php -a add -k $(key) -v "$(value)" + @echo Key updated. + .PHONY: i18n-ignore-key i18n-ignore-key: ## Ignore a translation key for the selected language ifndef lang -- cgit v1.2.3