Skip to content

Commit 2a803dd

Browse files
committed
add serbian aliases and underscore flag
1 parent f5cbeb2 commit 2a803dd

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

src/Commands/NovaLangPublish.php

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,10 @@ class NovaLangPublish extends Command
1919
{--all : Publish all languages}
2020
{--alias= : Publish files using a different filename for certain locales, in the format "locale:alias,..."}
2121
{--zhHans : Publish Chinese translations as "zh-Hans/Hant" instead of "zh-CN/TW" }
22-
{--ptBR : Publish Portuguese translations prioritising "pt-BR" as "pt" over "pt-PT" }
22+
{--ptBR : Publish Portuguese translations prioritizing "pt-BR" as "pt" over "pt-PT" }
23+
{--srCyrl : Publish Serbian Cyrillic translations as "sr-Cyrl" instead of "sr" }
24+
{--srLatn : Publish Serbian translations prioritizing "sr-Latn" as "sr" instead of "sr-Cyrl" }
25+
{--U|underscore : Use underscore instead of dash as locale separator }
2326
{--force : Override existing files}';
2427

2528
/**
@@ -78,6 +81,10 @@ public function handle()
7881

7982
$asAlias = '';
8083

84+
if ($this->option('underscore')) {
85+
$alias = str_replace('-', '_', $alias);
86+
}
87+
8188
if ($alias !== $locale) {
8289
$asAlias = sprintf(' as [%s]', $alias);
8390
}
@@ -159,8 +166,15 @@ protected function getLocaleAliases($single = false): Collection
159166
$this->option('alias'),
160167
$this->option('ptBR') ? 'pt:pt-PT,pt-BR:pt' : null,
161168
$this->option('zhHans') ? 'zh-CN:zh-Hans,zh-TW:zh-Hant' : null,
169+
$this->option('srCyrl') ? 'sr:sr-Cyrl' : null,
170+
$this->option('srLatn') ? 'sr-Latn:sr,sr:sr-Cyrl' : null,
162171
]));
163172

173+
if ($this->option('srCyrl') && $this->option('srLatn')) {
174+
$this->error('Options --srCyrl and --srLatn must not be used together.');
175+
exit;
176+
}
177+
164178
if ($input) {
165179

166180
$inputs = explode(',', $input);

0 commit comments

Comments
 (0)