<commit_before># -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
#
# This file is part of the LibreOffice project.
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#

# class UILocalizeTarget

gb_UILocalizeTarget_WORKDIR := $(WORKDIR)/UILocalizeTarget

gb_UILocalizeTarget_TARGET := $(call gb_Executable_get_target_for_build,uiex)
gb_UILocalizeTarget_COMMAND := $(gb_Helper_set_ldpath) $(gb_UILocalizeTarget_TARGET)

define gb_UILocalizeTarget__command
$(call gb_Output_announce,$(2),$(true),UIX,1)
$(call gb_Helper_abbreviate_dirs,\
	$(gb_UILocalizeTarget_COMMAND) \
		-i $(UI_FILE) \
		-o $(1) \
		-l $(UI_LANG) \
		-m $(SDF) \
)
endef

$(dir $(call gb_UILocalizeTarget_get_target,%))%/.dir :
	$(if $(wildcard $(dir $@)),,mkdir -p $(dir $@))

$(call gb_UILocalizeTarget_get_target,%) : $(gb_UILocalizeTarget_TARGET)
	$(call gb_UILocalizeTarget__command,$@,$*)

.PHONY : $(call gb_UILocalizeTarget_get_clean_target,%)
$(call gb_UILocalizeTarget_get_clean_target,%) :
	$(call gb_Output_announce,$*,$(false),UIX,1)
	$(call gb_Helper_abbreviate_dirs,\
		rm -f $(call gb_UILocalizeTarget_get_target,$*) \
	)

# Translates one .ui file
#
# gb_UILocalizeTarget_UILocalizeTarget target source lang
define gb_UILocalizeTarget_UILocalizeTarget
$(call gb_UILocalizeTarget_get_target,$(1)) : SDF := $(gb_SDFLOCATION)/$(dir $(2))localize.sdf
$(call gb_UILocalizeTarget_get_target,$(1)) : UI_FILE := $(SRCDIR)/$(2).ui
$(call gb_UILocalizeTarget_get_target,$(1)) : UI_LANG := $(3)

$(call gb_UILocalizeTarget_get_target,$(1)) : $$(SDF)
$(call gb_UILocalizeTarget_get_target,$(1)) : $$(UI_FILE)
$(call gb_UILocalizeTarget_get_target,$(1)) :| $(dir $(call gb_UILocalizeTarget_get_target,$(1))).dir

endef

# class UITarget

# en-US is a special case
gb_UITarget_LANGS := $(filter-out en-US,$(gb_WITH_LANG))

gb_UITarget_LOCALIZED_DIR := $(gb_UILocalizeTarget_WORKDIR)

gb_UITarget_get_uifile_for_lang = $(subst $(gb_UITarget_LOCALIZED_DIR)/,,$(call gb_UILocalizeTarget_get_target,$(1)/$(2)))

$(dir $(call gb_UITarget_get_target,%)).dir :
	$(if $(wildcard $(dir $@)),,mkdir -p $(dir $@))<commit_msg>Ui merge from po files<commit_after># -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
#
# This file is part of the LibreOffice project.
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#

# class UILocalizeTarget

gb_UILocalizeTarget_WORKDIR := $(WORKDIR)/UILocalizeTarget

gb_UILocalizeTarget_TARGET := $(call gb_Executable_get_target_for_build,uiex)
gb_UILocalizeTarget_COMMAND := $(gb_Helper_set_ldpath) $(gb_UILocalizeTarget_TARGET)

define gb_UILocalizeTarget__command
$(call gb_Output_announce,$(2),$(true),UIX,1)
MERGEINPUT=`$(gb_MKTEMP)` && \
echo $(POFILES) > $${MERGEINPUT} && \
$(call gb_Helper_abbreviate_dirs,\
	$(gb_UILocalizeTarget_COMMAND) \
		-i $(UI_FILE) \
		-o $(1) \
		-l $(UI_LANG) \
		-m $${MERGEINPUT} ) && \
rm -rf $${MERGEINPUT}

endef

$(dir $(call gb_UILocalizeTarget_get_target,%))%/.dir :
	$(if $(wildcard $(dir $@)),,mkdir -p $(dir $@))

$(call gb_UILocalizeTarget_get_target,%) : $(gb_UILocalizeTarget_TARGET)
	$(call gb_UILocalizeTarget__command,$@,$*)

.PHONY : $(call gb_UILocalizeTarget_get_clean_target,%)
$(call gb_UILocalizeTarget_get_clean_target,%) :
	$(call gb_Output_announce,$*,$(false),UIX,1)
	$(call gb_Helper_abbreviate_dirs,\
		rm -f $(call gb_UILocalizeTarget_get_target,$*) \
	)

# Translates one .ui file
#
# gb_UILocalizeTarget_UILocalizeTarget target source lang
define gb_UILocalizeTarget_UILocalizeTarget
$(call gb_UILocalizeTarget_get_target,$(1)) : POFILES := $(foreach lang,$(gb_UITarget_LANGS),$(gb_POLOCATION)/$(lang)/$(patsubst %/,%,$(dir $(2))).po)
$(call gb_UILocalizeTarget_get_target,$(1)) : UI_FILE := $(SRCDIR)/$(2).ui
$(call gb_UILocalizeTarget_get_target,$(1)) : UI_LANG := $(3)

$(call gb_UILocalizeTarget_get_target,$(1)) : $(foreach lang,$(gb_UITarget_LANGS),$(gb_POLOCATION)/$(lang)/$(patsubst %/,%,$(dir $(2))).po)
$(call gb_UILocalizeTarget_get_target,$(1)) : $$(UI_FILE)
$(call gb_UILocalizeTarget_get_target,$(1)) :| $(dir $(call gb_UILocalizeTarget_get_target,$(1))).dir

endef

# class UITarget

# en-US is a special case
gb_UITarget_LANGS := $(filter-out en-US,$(gb_WITH_LANG))

gb_UITarget_LOCALIZED_DIR := $(gb_UILocalizeTarget_WORKDIR)

gb_UITarget_get_uifile_for_lang = $(subst $(gb_UITarget_LOCALIZED_DIR)/,,$(call gb_UILocalizeTarget_get_target,$(1)/$(2)))

$(dir $(call gb_UITarget_get_target,%)).dir :
	$(if $(wildcard $(dir $@)),,mkdir -p $(dir $@))
{'fraction_non_alphanumeric': 0.16708701134930642, 'fraction_numerical': 0.00903741067675494, 'mean_word_length': 6.788870703764321, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3784472', 'n_tokens_mistral': 1992, 'n_tokens_neox': 1929, 'n_words': 340}