Skip to content

Commit ade98ae

Browse files
authored
Merge pull request #3 from session-foundation/fix/crowdin-locale-type-guard
fix: add crowdin locale type guard to desktop script
2 parents 8584158 + 62568d3 commit ade98ae

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

crowdin/generate_desktop_strings.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,10 @@ def convert_non_translatable_strings_to_type_script(input_file, output_path, exp
145145
file.write('\n')
146146
file.write("export type CrowdinLocale = (typeof crowdinLocales)[number];\n")
147147
file.write('\n')
148+
file.write('export function isCrowdinLocale(locale: string): locale is CrowdinLocale {\n')
149+
file.write(' return crowdinLocales.includes(locale as CrowdinLocale);\n')
150+
file.write('}\n')
151+
file.write('\n')
148152

149153

150154
def convert_all_files(input_directory):

0 commit comments

Comments
 (0)