@@ -25,6 +25,7 @@ class LocaleGenerator
25
25
private const FUNCTION_NAME_LIST_FIRST_ROW = 4 ;
26
26
private const ENGLISH_FUNCTION_CATEGORIES_COLUMN = 'A ' ;
27
27
private const ENGLISH_REFERENCE_COLUMN = 'B ' ;
28
+ private const EOL = "\n" ; // not PHP_EOL
28
29
29
30
/**
30
31
* @var string
@@ -109,10 +110,10 @@ protected function buildConfigFileForLocale($column, $locale): void
109
110
$ translationCell = $ this ->localeTranslations ->getCell ($ column . $ row );
110
111
$ translationValue = $ translationCell ->getValue ();
111
112
if (!empty ($ translationValue )) {
112
- $ errorCodeTranslation = "{$ errorCode } = {$ translationValue }" . PHP_EOL ;
113
+ $ errorCodeTranslation = "{$ errorCode } = {$ translationValue }" . self :: EOL ;
113
114
fwrite ($ configFile , $ errorCodeTranslation );
114
115
} else {
115
- $ errorCodeTranslation = "{$ errorCode }" . PHP_EOL ;
116
+ $ errorCodeTranslation = "{$ errorCode }" . self :: EOL ;
116
117
fwrite ($ configFile , $ errorCodeTranslation );
117
118
$ this ->log ("No {$ language } translation available for error code {$ errorCode }" );
118
119
}
@@ -126,7 +127,7 @@ protected function writeConfigArgumentSeparator($configFile, $column): void
126
127
$ translationCell = $ this ->localeTranslations ->getCell ($ column . self ::ARGUMENT_SEPARATOR_ROW );
127
128
$ localeValue = $ translationCell ->getValue ();
128
129
if (!empty ($ localeValue )) {
129
- $ functionTranslation = "ArgumentSeparator = {$ localeValue }" . PHP_EOL ;
130
+ $ functionTranslation = "ArgumentSeparator = {$ localeValue }" . self :: EOL ;
130
131
fwrite ($ configFile , $ functionTranslation );
131
132
} else {
132
133
$ this ->log ('No Argument Separator defined ' );
@@ -148,7 +149,7 @@ protected function buildFunctionsFileForLocale($column, $locale): void
148
149
} elseif (!array_key_exists ($ functionName , $ this ->phpSpreadsheetFunctions )) {
149
150
$ this ->log ("Function {$ functionName } is not defined in PhpSpreadsheet " );
150
151
} elseif (!empty ($ translationValue )) {
151
- $ functionTranslation = "{$ functionName } = {$ translationValue }" . PHP_EOL ;
152
+ $ functionTranslation = "{$ functionName } = {$ translationValue }" . self :: EOL ;
152
153
fwrite ($ functionFile , $ functionTranslation );
153
154
} else {
154
155
$ this ->log ("No {$ language } translation available for function {$ functionName }" );
@@ -200,20 +201,20 @@ protected function getLocaleFolder(string $locale): string
200
201
201
202
protected function writeFileHeader ($ localeFile , string $ localeLanguage , string $ language , string $ title ): void
202
203
{
203
- fwrite ($ localeFile , str_repeat ('# ' , 60 ) . PHP_EOL );
204
- fwrite ($ localeFile , '## ' . PHP_EOL );
205
- fwrite ($ localeFile , "## PhpSpreadsheet - {$ title }" . PHP_EOL );
206
- fwrite ($ localeFile , '## ' . PHP_EOL );
207
- fwrite ($ localeFile , "## {$ localeLanguage } ( {$ language }) " . PHP_EOL );
208
- fwrite ($ localeFile , '## ' . PHP_EOL );
209
- fwrite ($ localeFile , str_repeat ('# ' , 60 ) . PHP_EOL . PHP_EOL );
204
+ fwrite ($ localeFile , str_repeat ('# ' , 60 ) . self :: EOL );
205
+ fwrite ($ localeFile , '## ' . self :: EOL );
206
+ fwrite ($ localeFile , "## PhpSpreadsheet - {$ title }" . self :: EOL );
207
+ fwrite ($ localeFile , '## ' . self :: EOL );
208
+ fwrite ($ localeFile , "## {$ localeLanguage } ( {$ language }) " . self :: EOL );
209
+ fwrite ($ localeFile , '## ' . self :: EOL );
210
+ fwrite ($ localeFile , str_repeat ('# ' , 60 ) . self :: EOL . self :: EOL );
210
211
}
211
212
212
213
protected function writeFileSectionHeader ($ localeFile , string $ header ): void
213
214
{
214
- fwrite ($ localeFile , PHP_EOL . '## ' . PHP_EOL );
215
- fwrite ($ localeFile , "## {$ header }" . PHP_EOL );
216
- fwrite ($ localeFile , '## ' . PHP_EOL );
215
+ fwrite ($ localeFile , self :: EOL . '## ' . self :: EOL );
216
+ fwrite ($ localeFile , "## {$ header }" . self :: EOL );
217
+ fwrite ($ localeFile , '## ' . self :: EOL );
217
218
}
218
219
219
220
protected function openTranslationWorkbook (): void
@@ -339,6 +340,6 @@ private function log(string $message): void
339
340
return ;
340
341
}
341
342
342
- echo $ message , PHP_EOL ;
343
+ echo $ message , self :: EOL ;
343
344
}
344
345
}
0 commit comments