我有一个.properties文件,其中包含以下代码:
MultiLanguageView.language1=Turn off/on first language entries
MultiLanguageView.language2=Turn off/on second language entries
MultiLanguageView.toggle=Display works only/Display all entries
SearchView.headwords=Headwords
SearchView.headwords.tooltip=Headwords search
SearchView.entry=Headword
SearchView.entry.tooltip=Search in Italian headwords and in their French and German translations
SearchView.subentry=Subentry
SearchView.subentry.tooltip=Search in Italian subentries and in their French and German translations
SearchView.fullText=Full text
SearchView.fullText.tooltip=Full text search
SearchView.japentry=Headword (alphabetic)
SearchView.japentry.tooltip=Headwords search with a latin keyboard
SearchView.japentry.jap=Headword (\u6F22\u5B57)
SearchView.japentry.jap.tooltip=Headwords search with ideograms
SearchView.japfullText=Full text (alphabetic)
SearchView.japfullText.tooltip=Full text search with a latin keyboard
SearchView.japfullText.jap=Full text (\u6F22\u5B57)
SearchView.japfullText.jap.tooltip=Full text search with ideograms
SearchView.cinentry=Headword (alphabetic)
SearchView.cinentry.tooltip=Headwords search with a latin keyboard
SearchView.cinentry.cin=Headword (\u4e2d\u6587\u8bcd)
SearchView.cinentry.cin.tooltip=Headwords search with ideograms
SearchView.cinfullText=Full text (alphabetic)
SearchView.cinfullText.tooltip=Full text search with a latin keyboard
SearchView.cinfullText.cin=Full text<br>(\u4e2d\u6587\u8bcd)
SearchView.cinfullText.cin.tooltip=Full text search with ideograms
AdvancedSearchFieldSearchAction.HEADWORD_ADVANCED.results=Headwords: {2} additional entries found for \"{1}\"
AdvancedSearchFieldSearchAction.HEADWORD_ADVANCED.noresults=Headwords: no additional entries found for \"{1}\"
我需要将其转换为嵌套的JSON对象,以便在Angular 7中使用ngx-translate。
答案 0 :(得分:-1)
您可以在ngx-translate上使用TranslateLoader创建自定义加载器,唯一要做的就是解析属性文件。
我不知道这种文件类型,但是也许有一个图书馆可以理解这种文件语法或自己编写。