2 # This file is part of the LibreOffice project.
4 # This Source Code Form is subject to the terms of the Mozilla Public
5 # License, v. 2.0. If a copy of the MPL was not distributed with this
6 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 use List
::Util qw
[max
];
11 @ARGV == 0 or die 'Usage: translates from stdin to stdout';
17 next if /^\s*(#.*)?$/;
18 # Accept combinations of lll-Ssss-CC-vvvvvvvv
19 # XXX NOTE: when changing this also adapt
20 # setup_native/source/win32/customactions/sellang/sellang.cxx
21 # struct InstallLocalized{ char lang[sizeof(...)]; }
22 /^ \s
* ([a
-z
]{2,3}(?
:-[A
-Z
][a
-z
]{3})?
(?
:-[A
-Z
]{2})?
(?
:-[a
-z
]{5,8})?
) \s
* = \s
*
23 \"(EMPTY
|[a
-z
]{2,3}(?
:-[A
-Z
][a
-z
]{3})?
(?
:-[A
-Z
]{2})?
(?
:-[a
-z
]{5,8})?
24 (?
:,[a
-z
]{2,3}(?
:-[A
-Z
][a
-z
]{3})?
(?
:-[A
-Z
]{2})?
(?
:-[a
-z
]{5,8})?
)*)\" \s
* $/x
25 or die "unexpected input line \"$_\"";
30 !exists($map{$lang}) or die "duplicate values for $lang";
31 if ($dicts eq 'EMPTY') {
34 @
{$map{$lang}} = split(/,/, $dicts);
36 push(@
{$map{$lang}}, ('en')) unless grep($_ eq 'en', @
{$map{$lang}});
37 $max = max
($max, scalar(@
{$map{$lang}}));
43 // generated by setup_native/source/packinfo/spellchecker_selection.pl
45 #ifndef INCLUDED_SETUP_NATIVE_SOURCE_PACKINFO_SPELLCHECKER_SELECTION_HXX
46 #define INCLUDED_SETUP_NATIVE_SOURCE_PACKINFO_SPELLCHECKER_SELECTION_HXX
48 #include "sal/config.h"
50 namespace setup_native {
52 struct LanguageDictionaries {
53 char const * language;
54 char const * dictionaries[$max];
57 LanguageDictionaries const languageDictionaries[] = {
60 foreach $i (sort(keys(%map))) {
61 print(" { \"$i\", {");
62 foreach $j (sort(@
{$map{$i}})) {