def setUp(self): self.en_us_ftl = parse(FTLParser, ftl(''' # This Source Code Form is subject to the terms of … # A generic comment. title = Downloads header = Your Downloads empty = No Downloads # A section comment. [[ Menu items ]] # A message comment. open-menuitem = [html/label] Open download-state-downloading = Downloading… ''')) self.ab_cd_ftl = parse(FTLParser, ftl(''' # This Source Code Form is subject to the terms of … empty = Brak pobranych plików ''')) ab_cd_dtd = parse(DTDParser, ''' <!ENTITY aboutDownloads.title "Pobrane pliki"> <!ENTITY aboutDownloads.open "Otwórz"> ''') ab_cd_prop = parse(PropertiesParser, ''' downloadState.downloading=Pobieranie… ''') self.ab_cd_legacy = { key: val for strings in (ab_cd_dtd, ab_cd_prop) for key, val in strings.items() } self.transforms = [ FTL.Entity( FTL.Identifier('title'), value=LITERAL_FROM(None, 'aboutDownloads.title') ), FTL.Entity( FTL.Identifier('open-menuitem'), traits=[ FTL.Member( FTL.Keyword('label', 'html'), LITERAL_FROM(None, 'aboutDownloads.open') ), ] ), FTL.Entity( FTL.Identifier('download-state-downloading'), value=LITERAL_FROM(None, 'downloadState.downloading') ) ]
def setUp(self): self.en_us_ftl = parse(FTLParser, ftl(''' title = Downloads header = Your Downloads empty = No Downloads about = About Downloads open-menuitem = [html/label] Open download-state-downloading = Downloading… ''')) self.ab_cd_ftl = parse(FTLParser, ftl(''' empty = Brak pobranych plików about = Previously Hardcoded Value ''')) ab_cd_dtd = parse(DTDParser, ''' <!ENTITY aboutDownloads.title "Pobrane pliki"> <!ENTITY aboutDownloads.open "Otwórz"> ''') ab_cd_prop = parse(PropertiesParser, ''' downloadState.downloading=Pobieranie… ''') self.ab_cd_legacy = { key: val for strings in (ab_cd_dtd, ab_cd_prop) for key, val in strings.items() } self.transforms = [ FTL.Entity( FTL.Identifier('title'), value=LITERAL_FROM(None, 'aboutDownloads.title') ), FTL.Entity( FTL.Identifier('about'), value=LITERAL('Hardcoded Value') ), FTL.Entity( FTL.Identifier('open-menuitem'), traits=[ FTL.Member( FTL.Keyword('label', 'html'), LITERAL_FROM(None, 'aboutDownloads.open') ), ] ), FTL.Entity( FTL.Identifier('download-state-downloading'), value=LITERAL_FROM(None, 'downloadState.downloading') ) ]
def setUp(self): self.strings = parse(PropertiesParser, ''' hello = Hello, #1! welcome = Welcome, #1, to #2! first = #1 Bar last = Foo #1 ''')
def test_three_way_two_entities(self): ab_cd_ftl = parse(FTLParser, ftl(''' # This Source Code Form is subject to the terms of … empty = Brak pobranych plików ''')) subset = ('title', 'download-state-downloading') resource = merge_resource( self, self.en_us_ftl, ab_cd_ftl, self.transforms, in_changeset=lambda x: x in subset ) self.assertEqual( resource.toJSON(), ftl_resource_to_json(''' # This Source Code Form is subject to the terms of … # A generic comment. title = Pobrane pliki empty = Brak pobranych plików # A section comment. [[ Menu items ]] download-state-downloading = Pobieranie… ''') )
def setUp(self): self.strings = parse(DTDParser, ''' <!ENTITY community.start "&brandShortName; is designed by "> <!ENTITY community.mozillaLink "&vendorShortName;"> <!ENTITY community.middle ", a "> <!ENTITY community.creditsLink "global community"> <!ENTITY community.end " working together to…"> ''')
def setUp(self): self.strings = parse(PropertiesParser, ''' foo = Foo foo.unicode.middle = Foo\\u0020Bar foo.unicode.begin = \\u0020Foo foo.unicode.end = Foo\\u0020 foo.html.entity = <⇧⌘K> ''')
def setUp(self): self.strings = parse(PropertiesParser, ''' hello = Hello, world! hello.start = Hello,\\u0020 hello.end = world! whitespace.begin.start = \\u0020Hello,\\u0020 whitespace.begin.end = world! whitespace.end.start = Hello,\\u0020 whitespace.end.end = world!\\u0020 ''')
def setUp(self): self.strings = parse(PropertiesParser, ''' deleteAll=Delete this download?;Delete all downloads? ''') self.message = FTL.Entity( FTL.Identifier('delete-all'), value=PLURALS_FROM( self.strings, 'deleteAll', FTL.ExternalArgument('num'), lambda var: LITERAL(var) ) )
def test_three_way_one_entity_existing_section(self): ab_cd_ftl = parse(FTLParser, ftl(''' # This Source Code Form is subject to the terms of … empty = Brak pobranych plików # A section comment. [[ Menu items ]] # A message comment. open-menuitem = [html/label] Otwórz ''')) subset = ('title',) resource = merge_resource( self, self.en_us_ftl, ab_cd_ftl, self.transforms, in_changeset=lambda x: x in subset ) self.assertEqual( resource.toJSON(), ftl_resource_to_json(''' # This Source Code Form is subject to the terms of … # A generic comment. title = Pobrane pliki empty = Brak pobranych plików # A section comment. [[ Menu items ]] # A message comment. open-menuitem = [html/label] Otwórz ''') )
def test_three_way_one_entity(self): ab_cd_ftl = parse(FTLParser, ftl(''' # This Source Code Form is subject to the terms of … empty = Brak pobranych plików ''')) subset = ('title',) resource = merge_resource( self, self.en_us_ftl, ab_cd_ftl, self.transforms, in_changeset=lambda x: x in subset ) self.assertEqual( resource.toJSON(), ftl_resource_to_json(''' # This Source Code Form is subject to the terms of … # A generic comment. title = Pobrane pliki empty = Brak pobranych plików ''') )
def setUp(self): self.strings = parse(DTDParser, ''' <!ENTITY channel.description.start "You are on the "> <!ENTITY channel.description.end " channel. "> ''')
def setUp(self): self.strings = parse(DTDParser, ''' <!ENTITY update.failed.start "Update failed. "> <!ENTITY update.failed.linkText "Download manually"> <!ENTITY update.failed.end "!"> ''')
def setUp(self): self.strings = parse(DTDParser, ''' <!ENTITY checkForUpdatesButton.label "Check for updates"> <!ENTITY checkForUpdatesButton.accesskey "C"> ''')
def setUp(self): self.strings = parse(PropertiesParser, ''' deleteAll=Delete this download?;Delete #1 downloads? ''')