summaryrefslogtreecommitdiffstats
path: root/setup_native/source/packinfo/spellchecker_selection.pl
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 09:06:44 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 09:06:44 +0000
commited5640d8b587fbcfed7dd7967f3de04b37a76f26 (patch)
tree7a5f7c6c9d02226d7471cb3cc8fbbf631b415303 /setup_native/source/packinfo/spellchecker_selection.pl
parentInitial commit. (diff)
downloadlibreoffice-ed5640d8b587fbcfed7dd7967f3de04b37a76f26.tar.xz
libreoffice-ed5640d8b587fbcfed7dd7967f3de04b37a76f26.zip
Adding upstream version 4:7.4.7.upstream/4%7.4.7upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'setup_native/source/packinfo/spellchecker_selection.pl')
-rw-r--r--setup_native/source/packinfo/spellchecker_selection.pl74
1 files changed, 74 insertions, 0 deletions
diff --git a/setup_native/source/packinfo/spellchecker_selection.pl b/setup_native/source/packinfo/spellchecker_selection.pl
new file mode 100644
index 000000000..317501397
--- /dev/null
+++ b/setup_native/source/packinfo/spellchecker_selection.pl
@@ -0,0 +1,74 @@
+#
+# 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/.
+#
+
+use List::Util qw[max];
+
+@ARGV == 0 or die 'Usage: translates from stdin to stdout';
+
+my %map = ();
+my $max = 0;
+
+while (<>) {
+ next if /^\s*(#.*)?$/;
+ # Accept combinations of lll-Ssss-CC-vvvvvvvv
+ # XXX NOTE: when changing this also adapt
+ # setup_native/source/win32/customactions/sellang/sellang.cxx
+ # struct InstallLocalized{ char lang[sizeof(...)]; }
+ /^ \s* ([a-z]{2,3}(?:-[A-Z][a-z]{3})?(?:-[A-Z]{2})?(?:-[a-z]{5,8})?) \s* = \s*
+ \"(EMPTY|[a-z]{2,3}(?:-[A-Z][a-z]{3})?(?:-[A-Z]{2})?(?:-[a-z]{5,8})?
+ (?:,[a-z]{2,3}(?:-[A-Z][a-z]{3})?(?:-[A-Z]{2})?(?:-[a-z]{5,8})?)*)\" \s* $/x
+ or die "unexpected input line \"$_\"";
+ my $lang = $1;
+ $lang =~ tr/-/_/;
+ my $dicts = $2;
+ $dicts =~ tr/-/_/;
+ !exists($map{$lang}) or die "duplicate values for $lang";
+ if ($dicts eq 'EMPTY') {
+ @{$map{$lang}} = ();
+ } else {
+ @{$map{$lang}} = split(/,/, $dicts);
+ }
+ push(@{$map{$lang}}, ('en')) unless grep($_ eq 'en', @{$map{$lang}});
+ $max = max($max, scalar(@{$map{$lang}}));
+}
+
+++$max;
+
+print <<EOF;
+// generated by setup_native/source/packinfo/spellchecker_selection.pl
+
+#ifndef INCLUDED_SETUP_NATIVE_SOURCE_PACKINFO_SPELLCHECKER_SELECTION_HXX
+#define INCLUDED_SETUP_NATIVE_SOURCE_PACKINFO_SPELLCHECKER_SELECTION_HXX
+
+#include "sal/config.h"
+
+namespace setup_native {
+
+struct LanguageDictionaries {
+ char const * language;
+ char const * dictionaries[$max];
+};
+
+LanguageDictionaries const languageDictionaries[] = {
+EOF
+
+foreach $i (sort(keys(%map))) {
+ print(" { \"$i\", {");
+ foreach $j (sort(@{$map{$i}})) {
+ print(" \"$j\",");
+ }
+ print(" 0 } },\n");
+}
+
+print <<EOF;
+};
+
+}
+
+#endif
+EOF