Skip to content

Commit

Permalink
Avoid Zinc dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
gcotelli committed Aug 27, 2024
1 parent 5a780e2 commit 65d8c7a
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ Class {
#superclass : 'Object',
#instVars : [
'targetRepository',
'base64Codec',
'environment'
],
#category : 'Buoy-Development-Tools-Pharo-12',
Expand Down Expand Up @@ -41,7 +40,7 @@ NaturalLanguageTranslationScanner >> exportOn: writeStream [
translator := MonoglotNaturalLanguageTranslator for: 'en' asLanguageRange.
translations := OrderedDictionary new.
stringsToTranslate do: [ :string |
translations at: ( base64Codec encode: ( translator hashCodeFor: string ) ) put: string ].
translations at: ( translator hashCodeFor: string ) hex put: string ].

( NeoJSONWriter on: writeStream )
prettyPrint: true;
Expand Down Expand Up @@ -69,9 +68,6 @@ NaturalLanguageTranslationScanner >> initializeForProjectNamed: aProjectName [
( 'Missing repository for project named <1s>' expandMacrosWith:
aProjectName )
].
base64Codec := ZnBase64Encoder new
beForURLEncoding;
noPadding.
environment := RBBrowserEnvironment new forPackageNames:
( targetRepository project packageNames select: [ :name |
PackageOrganizer default hasPackage: name ] )
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ PolyglotNaturalLanguageTranslatorTest >> exportSpanishTranslationsIn: location [

spanishLocation / 'tests.json' writeStreamDo: [ :stream |
stream nextPutAll:
'{"Tests":{"6guTfqMXEB7iwmsDpIQ6Gc7O2KK5Zzw89AmnJsorD9g":"Argentina","B_YrAhdx089n4uH68YdpzF5cEZrX1NGEehHhHW1afss":"Brasil","qlqzWpF0wgYrf3aXsz-v5c5ATPX-z2v7vw3Ja6DZAEY":"EEUU"}}'
'{"Tests":{"ea0b937ea317101ee2c26b03a4843a19ceced8a2b9673c3cf409a726ca2b0fd8":"Argentina","07f62b021771d3cf67e2e1faf18769cc5e5c119ad7d4d1847a11e11d6d5a7ecb":"Brasil","aa5ab35a9174c2062b7f7697b33fafe5ce404cf5fecf6bfbbf0dc96ba0d90046":"EEUU"}}'
]
]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,17 +38,17 @@ PolyglotNaturalLanguageTranslator >> loadJSONTranslationsFor: languageRange in:
and a second level where the key is the translation key and the value is the
translated string."

| codec monoglotTranslator |
codec := ZnBase64Encoder new.
codec beForURLEncoding.
| monoglotTranslator |
monoglotTranslator := self translatorFor: languageRange.

^ localeDirectory files select: [ :file | file extension = 'json' ] thenDo: [ :file |
| groupedTranslations |
groupedTranslations := STON fromString: file contents.
groupedTranslations keysAndValuesDo: [ :group :translations |
translations keysAndValuesDo: [ :translationKey :translation |
monoglotTranslator translationAt: ( codec decode: translationKey ) put: translation ]
monoglotTranslator
translationAt: ( ByteArray readHexFrom: translationKey )
put: translation ]
]
]
]
Expand Down

0 comments on commit 65d8c7a

Please sign in to comment.