<body><div id="__MailbirdStyleContent" style="font-size: 10pt;font-family: Arial;color: #000000">
Hi all!<div><br></div><div>Here are more detailed benchmarks:</div><div><br></div><div><div><span style="font-size: 13.3333px">Image: 6.0alpha (Update 20067)</span></div><div><span style="font-size: 13.3333px">VM: 202007252116 (32-bit, Windows 10)</span></div><div><span style="font-size: 13.3333px">Translations: 27 .mo files (aka. text domains) -> GetTextTranslator</span></div><div><span style="font-size: 13.3333px"><br></span></div><div><span style="font-size: 13.3333px">"1) Time to switch locale. Only workspace and docking bar."</span></div><div><span style="font-size: 13.3333px">Locale switchAndInstallFontToID: (LocaleID isoLanguage: 'en').</span></div><div><span style="font-size: 13.3333px">[Locale switchAndInstallFontToID: (LocaleID isoLanguage: 'de')] timeToRunWithoutGC.</span></div><div><span style="font-size: 13.3333px">"BEFORE: 1577 ms"</span></div><div><span style="font-size: 13.3333px">"AFTER: 1327 ms"</span></div><div><span style="font-size: 13.3333px"><br></span></div><div><span style="font-size: 13.3333px">"2) Bench fastest lookup path"</span></div><div><span style="font-size: 13.3333px">['world' translatedInDomain: #Morphic] bench.</span></div><div><span style="font-size: 13.3333px">"BEFORE: '405,000 per second. 2.47 microseconds per run. 4.64 % GC time.'"</span></div><div><span style="font-size: 13.3333px">"AFTER: '433,000 per second. 2.31 microseconds per run. 6.07878 % GC time.'""</span></div><div><span style="font-size: 13.3333px"><br></span></div><div><span style="font-size: 13.3333px">"3) Bench try-any-domain fallback."</span></div><div><span style="font-size: 13.3333px">['world' translated] bench.</span></div><div><span style="font-size: 13.3333px">"BEFORE: '20,300 per second. 49.2 microseconds per run. 11.33773 % GC time.'"</span></div><div><span style="font-size: 13.3333px">"AFTER: '133,000 per second. 7.53 microseconds per run. 8.09838 % GC time.'"</span></div><div><span style="font-size: 13.3333px"><br></span></div><div><span style="font-size: 13.3333px">"4) No translation found."</span></div><div><span style="font-size: 13.3333px">['Hello, World!' translated] bench.</span></div><div><span style="font-size: 13.3333px">"BEFORE: '16,200 per second. 61.9 microseconds per run. 13.9772 % GC time.'"</span></div><div><span style="font-size: 13.3333px">"AFTER: '98,600 per second. 10.1 microseconds per run. 7.63847 % GC time.'"</span></div><div><span style="font-size: 13.3333px"><br></span></div><div><span style="font-size: 13.3333px">****</span></div><div><span style="font-size: 13.3333px"><br></span></div><div><span style="font-size: 13.3333px">vvvv Translations: 0 .mo files --> InternalTranslator vvvv</span></div><div><span style="font-size: 13.3333px"><br></span></div><div><span style="font-size: 13.3333px"><br></span></div><div><span style="font-size: 13.3333px">['world' translatedInDomain: #Morphic] bench.</span></div><div><span style="font-size: 13.3333px">"BEFORE: '8,180 per second. 122 microseconds per run. 2.87942 % GC time.'"</span></div><div><span style="font-size: 13.3333px">"AFTER: '760,000 per second. 1.32 microseconds per run. 3.95921 % GC time.'"</span></div><div><span style="font-size: 13.3333px"><br></span></div><div><span style="font-size: 13.3333px">['world' translated] bench.</span></div><div><span style="font-size: 13.3333px">"BEFORE: '8,210 per second. 122 microseconds per run. 2.98 % GC time.'"</span></div><div><span style="font-size: 13.3333px">"AFTER: '670,000 per second. 1.49 microseconds per run. 4.62 % GC time.'"</span></div><div><span style="font-size: 13.3333px"><br></span></div><div><span style="font-size: 13.3333px">['Hello, World!' translated] bench.</span></div><div><span style="font-size: 13.3333px">"BEFORE: '8,100 per second. 124 microseconds per run. 3.76 % GC time.'"</span></div><div><span style="font-size: 13.3333px">"AFTER: '672,000 per second. 1.49 microseconds per run. 5.48 % GC time.'"</span></div></div><div><span style="font-size: 13.3333px"><br></span></div><div><span style="font-size: 13.3333px">Best,</span></div><div><span style="font-size: 13.3333px">Marcel</span></div><div class="mb_sig"></div><blockquote class='history_container' type='cite' style='border-left-style:solid;border-width:1px; margin-top:20px; margin-left:0px;padding-left:10px;'>
<p style='color: #AAAAAA; margin-top: 10px;'>Am 05.11.2020 16:23:56 schrieb commits@source.squeak.org <commits@source.squeak.org>:</p><div style='font-family:Arial,Helvetica,sans-serif'>Marcel Taeumel uploaded a new version of System to project The Trunk:
<br>http://source.squeak.org/trunk/System-mt.1190.mcz
<br>
<br>==================== Summary ====================
<br>
<br>Name: System-mt.1190
<br>Author: mt
<br>Time: 5 November 2020, 4:23:31.287798 pm
<br>UUID: 832d3d0e-dc06-a14f-ac49-d7dc709680ea
<br>Ancestors: System-mt.1189
<br>
<br>Speeds up String >> #translated and locale switching as follows:
<br>- Only call #localeChanged(Gently) on classes that implement it, just like #cleanUp:
<br>- For the InternalTranslator, make translation-in-all-domains a no-op; 122µs -> 1.3µs
<br>- For the GetTextTranslator, make translation-in-all-domains fetch all available .mo files once, then directly enumerate that cache until a result is found; roughly 50µs -> 8µs
<br>- Avoid loading all .mo files on #localeChanged(Gently); only do that for translation-in-all-domains
<br>
<br>=============== Diff against System-mt.1189 ===============
<br>
<br>Item was added:
<br>+ ----- Method: GetTextTranslator class>>addUserDefaultLocaleDir: (in category 'translation data layout') -----
<br>+ addUserDefaultLocaleDir: dir
<br>+ "new dir will be put as first"
<br>+ self userDefaultLocaleDirs addFirst: dir!
<br>
<br>Item was changed:
<br> ----- Method: GetTextTranslator class>>availableLanguageLocaleIDs (in category 'accessing') -----
<br> availableLanguageLocaleIDs
<br> "GetTextTranslator availableLanguageLocaleIDs"
<br> | ids dirs localeDirForLang directoryNames |
<br> ids := Set new.
<br> dirs := Set new.
<br>+ dirs addAll: self localeDirsForDomain.
<br>+ dirs addAll: self userDefaultLocaleDirs.
<br>+ dirs addAll: self systemDefaultLocaleDirs.
<br>- dirs addAll: LocaleDirsForDomain values.
<br>- dirs addAll: self defaultLocaleDirs.
<br> dirs do: [:dir |
<br> | localesDir |
<br> localesDir := FileDirectory on: dir.
<br> directoryNames := [localesDir directoryNames] on: InvalidDirectoryError do: [:e | #()].
<br> directoryNames
<br> do: [:langDirName |
<br> | localeID |
<br> localeID := LocaleID posixName: langDirName.
<br> localeDirForLang := localesDir directoryNamed: (self langDirNameForLocaleID: localeID).
<br> localeDirForLang ifNotNil: [
<br> (localeDirForLang fileNamesMatching: '*.mo') ifNotEmpty: [ids add: localeID]].
<br> localeID hasParent ifTrue: [
<br> localeDirForLang := localesDir directoryNamed: (self langDirNameForLocaleID: localeID parent).
<br> localeDirForLang ifNotNil: [
<br> (localeDirForLang fileNamesMatching: '*.mo') ifNotEmpty: [ids add: localeID parent]]].
<br> ].
<br> ].
<br> ^ids!
<br>
<br>Item was added:
<br>+ ----- Method: GetTextTranslator class>>cleanUp: (in category 'class initialization') -----
<br>+ cleanUp: aggressive
<br>+
<br>+ aggressive ifTrue: [
<br>+ UserDefaultLocaleDirs := OrderedCollection new.
<br>+ LocaleDirsForDomain := Dictionary new].!
<br>
<br>Item was removed:
<br>- ----- Method: GetTextTranslator class>>defaultLocaleDirs (in category 'translation data layout') -----
<br>- defaultLocaleDirs
<br>- | dirs |
<br>- dirs := OrderedCollection new.
<br>- UserDefaultLocaleDirs ifNotNil: [dirs addAll: UserDefaultLocaleDirs].
<br>- dirs addAll: self systemDefaultLocaleDirs.
<br>- ^dirs
<br>- !
<br>
<br>Item was added:
<br>+ ----- Method: GetTextTranslator class>>findAllMOsForLocaleID: (in category 'private') -----
<br>+ findAllMOsForLocaleID: id
<br>+
<br>+ | relativePath path allMONames result |
<br>+ relativePath := String streamContents: [:stream |
<br>+ stream
<br>+ nextPutAll: FileDirectory slash;
<br>+ nextPutAll: (self langDirNameForLocaleID: id);
<br>+ nextPutAll: FileDirectory slash].
<br>+ allMONames := TextDomainManager allKnownDomains
<br>+ collect: [:each | each -> (self moNameForDomain: each)].
<br>+ result := OrderedCollection new.
<br>+ self localeDirsDo: [:localeDir |
<br>+ allMONames do: [:moName |
<br>+ path := String streamContents: [:s |
<br>+ s nextPutAll: localeDir; nextPutAll: relativePath; nextPutAll: moName value].
<br>+ ([FileDirectory default fileExists: path] on: InvalidDirectoryError do: [false])
<br>+ ifTrue: [result add: moName key -> path] ]].
<br>+ ^ result!
<br>
<br>Item was changed:
<br> ----- Method: GetTextTranslator class>>findMOForLocaleID:domain: (in category 'private') -----
<br> findMOForLocaleID: id domain: aDomainName
<br>+
<br>+ | relativePath path |
<br>+ relativePath := String streamContents: [:stream |
<br>+ stream
<br>+ nextPutAll: FileDirectory slash;
<br>+ nextPutAll: (self langDirNameForLocaleID: id);
<br>+ nextPutAll: FileDirectory slash;
<br>+ nextPutAll: (self moNameForDomain: aDomainName)].
<br>+ self
<br>+ localeDirsForDomain: aDomainName
<br>+ do: [:localeDir |
<br>+ path := localeDir, relativePath.
<br>+ ([FileDirectory default fileExists: path] on: InvalidDirectoryError do: [false])
<br>+ ifTrue: [^ path]].
<br>+ ^ nil!
<br>- | sepa langSubDir path |
<br>- sepa := FileDirectory slash.
<br>- langSubDir := self langDirNameForLocaleID: id.
<br>- (self localeDirsForDomain: aDomainName)
<br>- do: [:each |
<br>- path := each , sepa , langSubDir, sepa , (self moNameForDomain: aDomainName).
<br>- [(FileDirectory default fileExists: path)
<br>- ifTrue: [^path]] on: InvalidDirectoryError do: [:e | ^nil]].
<br>- ^nil.!
<br>
<br>Item was added:
<br>+ ----- Method: GetTextTranslator class>>getLocaleDirForDomain: (in category 'translation data layout') -----
<br>+ getLocaleDirForDomain: aDomainName
<br>+ "returns registered localeDirectory for the textdomain. returns nil if not registered"
<br>+ ^LocaleDirsForDomain at: aDomainName ifAbsent: [nil]!
<br>
<br>Item was removed:
<br>- ----- Method: GetTextTranslator class>>localeDirForDomain: (in category 'translation data layout') -----
<br>- localeDirForDomain: aDomainName
<br>- "returns registered localeDirectory for the textdomain. returns nil if not registered"
<br>- ^LocaleDirsForDomain at: aDomainName ifAbsent: [nil]!
<br>
<br>Item was added:
<br>+ ----- Method: GetTextTranslator class>>localeDirsDo: (in category 'translation data layout') -----
<br>+ localeDirsDo: workBlock
<br>+ "Enumerates all locale directories, regardless of a specific text domain. Begin with domain-specific directories, then user-specific directories, finally system-specific directories."
<br>+
<br>+ self localeDirsForDomain do: workBlock.
<br>+ self userDefaultLocaleDirs do: workBlock.
<br>+ self systemDefaultLocaleDirs do: workBlock.!
<br>
<br>Item was changed:
<br>+ ----- Method: GetTextTranslator class>>localeDirsForDomain (in category 'accessing') -----
<br>- ----- Method: GetTextTranslator class>>localeDirsForDomain (in category 'private') -----
<br> localeDirsForDomain
<br>+
<br>+ ^ LocaleDirsForDomain values!
<br>- ^LocaleDirsForDomain ifNil: [LocaleDirsForDomain := Dictionary new]!
<br>
<br>Item was removed:
<br>- ----- Method: GetTextTranslator class>>localeDirsForDomain: (in category 'translation data layout') -----
<br>- localeDirsForDomain: aDomainName
<br>- "returns collection of locale directories for text domain.
<br>- This includes user defined one for the domain, user defaults and system defaults"
<br>- | dirs dir |
<br>- dirs := OrderedCollection new.
<br>- dir := self localeDirForDomain: aDomainName.
<br>- dir ifNotNil: [dirs add: dir].
<br>- dirs addAll: self defaultLocaleDirs.
<br>- ^dirs!
<br>
<br>Item was added:
<br>+ ----- Method: GetTextTranslator class>>localeDirsForDomain:do: (in category 'translation data layout') -----
<br>+ localeDirsForDomain: aDomainName do: workBlock
<br>+ "Enumerates all locale directories for the text domain. Begin with domain-specific directories, then user-specific directories, finally system-specific directories."
<br>+
<br>+ (self getLocaleDirForDomain: aDomainName)
<br>+ ifNotNil: [:dir | workBlock value: dir].
<br>+
<br>+ self userDefaultLocaleDirs do: workBlock.
<br>+ self systemDefaultLocaleDirs do: workBlock.!
<br>
<br>Item was changed:
<br> ----- Method: GetTextTranslator class>>privateStartUp (in category 'class initialization') -----
<br> privateStartUp
<br>+ self setSystemDefaultLocaleDirs.
<br>- self setupLocaleDirs.
<br> self availableLanguageLocaleIDs do: [ :localeID |
<br> NaturalLanguageTranslator translators
<br> at: localeID
<br> put: (self newForLocaleID: localeID).
<br> ]!
<br>
<br>Item was removed:
<br>- ----- Method: GetTextTranslator class>>setLocaleDir:forDoamin: (in category 'translation data layout') -----
<br>- setLocaleDir: path forDoamin: aDomainName
<br>- self LocaleDirsForDomain
<br>- at: aDomainName
<br>- put: path.!
<br>
<br>Item was added:
<br>+ ----- Method: GetTextTranslator class>>setLocaleDirForDomain:to: (in category 'translation data layout') -----
<br>+ setLocaleDirForDomain: aDomainName to: aPath
<br>+
<br>+ LocaleDirsForDomain at: aDomainName put: aPath.!
<br>
<br>Item was added:
<br>+ ----- Method: GetTextTranslator class>>setSystemDefaultLocaleDirs (in category 'translation data layout') -----
<br>+ setSystemDefaultLocaleDirs
<br>+
<br>+ | dirs sepa localesDirName |
<br>+ sepa := FileDirectory slash.
<br>+ SystemDefaultLocaleDirs := nil.
<br>+ dirs := self systemDefaultLocaleDirs.
<br>+ localesDirName := 'locale'.
<br>+ { Smalltalk imagePath. Smalltalk vmPath } do: [:path |
<br>+ dirs addIfNotPresent: ((path endsWith: sepa)
<br>+ ifTrue: [path, localesDirName]
<br>+ ifFalse: [path, sepa, localesDirName])].!
<br>
<br>Item was removed:
<br>- ----- Method: GetTextTranslator class>>setupLocaleDirs (in category 'translation data layout') -----
<br>- setupLocaleDirs
<br>- | dirs sepa localesDirName |
<br>- sepa := FileDirectory slash.
<br>- SystemDefaultLocaleDirs := nil.
<br>- dirs := self systemDefaultLocaleDirs.
<br>- localesDirName := 'locale'.
<br>- dirs add: (Smalltalk imagePath) , sepa , localesDirName.
<br>- dirs add: (Smalltalk vmPath) , sepa , localesDirName.
<br>- ^dirs!
<br>
<br>Item was changed:
<br>+ ----- Method: GetTextTranslator class>>systemDefaultLocaleDirs (in category 'accessing') -----
<br>- ----- Method: GetTextTranslator class>>systemDefaultLocaleDirs (in category 'translation data layout') -----
<br> systemDefaultLocaleDirs
<br> ^SystemDefaultLocaleDirs ifNil: [SystemDefaultLocaleDirs := OrderedCollection new]
<br> !
<br>
<br>Item was changed:
<br>+ ----- Method: GetTextTranslator class>>userDefaultLocaleDirs (in category 'accessing') -----
<br>- ----- Method: GetTextTranslator class>>userDefaultLocaleDirs (in category 'translation data layout') -----
<br> userDefaultLocaleDirs
<br> ^UserDefaultLocaleDirs ifNil: [UserDefaultLocaleDirs := OrderedCollection new]
<br> !
<br>
<br>Item was changed:
<br> ----- Method: GetTextTranslator>>initialize (in category 'initialize-release') -----
<br> initialize
<br>+
<br>+ super initialize.
<br> moFiles := Dictionary new.!
<br>
<br>Item was removed:
<br>- ----- Method: GetTextTranslator>>loadMOFiles (in category 'accessing') -----
<br>- loadMOFiles
<br>- TextDomainManager allKnownDomains
<br>- do: [:domainName |
<br>- self moFileForDomain: domainName
<br>- ].!
<br>
<br>Item was added:
<br>+ ----- Method: GetTextTranslator>>loadMOFilesForAllDomains (in category 'private') -----
<br>+ loadMOFilesForAllDomains
<br>+
<br>+ moFiles := Dictionary new.
<br>+ moFiles at: #* put: OrderedCollection new.
<br>+
<br>+ (self class findAllMOsForLocaleID: self localeID) do: [:moName |
<br>+ | moFile |
<br>+ moFile := MOFile new load: moName value localeID: self localeID.
<br>+ moFiles at: moName key put: moFile.
<br>+ (moFiles at: #*) add: moFile].
<br>+
<br>+ ^ moFiles at: #*!
<br>
<br>Item was added:
<br>+ ----- Method: GetTextTranslator>>localeChanged (in category 'language switching') -----
<br>+ localeChanged
<br>+ "Reset cached .mo files. They will be loaded again as needed."
<br>+
<br>+ moFiles := Dictionary new.!
<br>
<br>Item was removed:
<br>- ----- Method: GetTextTranslator>>reloadMOFiles (in category 'accessing') -----
<br>- reloadMOFiles
<br>- moFiles := Dictionary new.
<br>- self loadMOFiles.!
<br>
<br>Item was removed:
<br>- ----- Method: GetTextTranslator>>setCurrent (in category 'language switching') -----
<br>- setCurrent
<br>- "ensure actual contents of MOs is loaded on switching language"
<br>- self loadMOFiles!
<br>
<br>Item was added:
<br>+ ----- Method: GetTextTranslator>>translateInAllDomains: (in category 'translation') -----
<br>+ translateInAllDomains: aString
<br>+
<br>+ | translation |
<br>+ (self moFiles at: #* ifAbsent: [self loadMOFilesForAllDomains])
<br>+ do: [:moFile |
<br>+ translation := moFile translationFor: aString.
<br>+ translation == aString ifFalse: [^ translation]].
<br>+ ^ aString "no translation found"!
<br>
<br>Item was added:
<br>+ ----- Method: InternalTranslator>>translateInAllDomains: (in category 'translation') -----
<br>+ translateInAllDomains: aString
<br>+ "Domains do not matter for the internal translator."
<br>+
<br>+ ^ aString!
<br>
<br>Item was changed:
<br> ----- Method: Locale class>>localeChanged (in category 'notification') -----
<br> localeChanged
<br>+
<br>+ NaturalLanguageTranslator localeChanged.
<br> SystemNavigation default allBehaviorsDo: [:b |
<br>+ (b ~~ self and: [b ~~ NaturalLanguageTranslator])
<br>+ ifTrue: [(b class includesSelector: #localeChanged)
<br>+ ifTrue: [b localeChanged]]].!
<br>- b == self ifFalse: [b localeChanged]].!
<br>
<br>Item was changed:
<br> ----- Method: Locale class>>localeChangedGently (in category 'notification') -----
<br> localeChangedGently
<br>+
<br>+ NaturalLanguageTranslator localeChangedGently.
<br>+ SystemNavigation default allBehaviorsDo: [:b |
<br>+ (b ~~ self and: [b ~~ NaturalLanguageTranslator])
<br>+ ifTrue: [(b class includesSelector: #localeChangedGently)
<br>+ ifTrue: [b localeChangedGently]]].!
<br>- SystemNavigation default allBehaviorsDo: [:b | b == self ifFalse: [b localeChangedGently]].!
<br>
<br>Item was changed:
<br> ----- Method: Locale class>>switchTo:gently: (in category 'accessing') -----
<br> switchTo: locale gently: gentlyFlag
<br> "Locale switchTo: (Locale isoLanguage: 'de')"
<br> | availableID |
<br> availableID := (NaturalLanguageTranslator availableForLocaleID: locale localeID) localeID.
<br> Current localeID = availableID
<br> ifFalse: [Previous := Current.
<br> CurrentPlatform := Current := Locale localeID: availableID.
<br>- NaturalLanguageTranslator localeChanged.
<br> gentlyFlag ifTrue: [self localeChangedGently] ifFalse: [self localeChanged]]!
<br>
<br>Item was changed:
<br> ----- Method: NaturalLanguageTranslator class>>localeChanged (in category 'accessing') -----
<br> localeChanged
<br> "notify some project starts to use this locale.
<br> this facility may use the event to load translation data dynamically"
<br>+ self current localeChanged.
<br>- self current setCurrent
<br> !
<br>
<br>Item was added:
<br>+ ----- Method: NaturalLanguageTranslator>>localeChanged (in category 'language switching') -----
<br>+ localeChanged
<br>+ "The system's current locale (ID) changed. Make sure to update all lookup caches if your translator needs external resources such as files."!
<br>
<br>Item was removed:
<br>- ----- Method: NaturalLanguageTranslator>>setCurrent (in category 'language switching') -----
<br>- setCurrent
<br>- "notify locale of the translator become current"
<br>- !
<br>
<br>Item was added:
<br>+ ----- Method: NaturalLanguageTranslator>>translateInAllDomains: (in category 'translation') -----
<br>+ translateInAllDomains: aString
<br>+
<br>+ | translation |
<br>+ TextDomainManager allKnownDomains do: [:domain |
<br>+ translation := self translate: aString inDomain: domain.
<br>+ aString == translation ifFalse: [^ translation]].
<br>+ ^ aString!
<br>
<br>Item was changed:
<br> ----- Method: String>>translated (in category '*System-Localization') -----
<br> translated
<br>+ "Note that we cannot call #translatedTo: because the sender context encodes the domain name."
<br>+
<br>+ ^ self
<br>- "answer the receiver translated to the default language"
<br>- | translation |
<br>- translation := self
<br> translatedTo: LocaleID current
<br>+ inDomain: (TextDomainManager domainOfMethod: thisContext sender method)!
<br>- inDomain: (TextDomainManager domainOfMethod: thisContext sender method).
<br>- self == translation ifTrue: [^self translatedInAllDomains].
<br>- ^translation!
<br>
<br>Item was removed:
<br>- ----- Method: String>>translatedInAllDomains (in category '*System-Localization') -----
<br>- translatedInAllDomains
<br>- | translation |
<br>- "Transcript show: self printString, ' translatedInAllDomains'; cr."
<br>- TextDomainManager allKnownDomains do: [:domain |
<br>- translation := self translatedTo: LocaleID current inDomain: domain.
<br>- self = translation ifFalse: [^translation]
<br>- ].
<br>- ^self!
<br>
<br>Item was removed:
<br>- ----- Method: String>>translatedInAnyDomain (in category '*System-Localization') -----
<br>- translatedInAnyDomain
<br>- | translation |
<br>- Transcript show: self printString, ' translatedInAnyDomain'; cr.
<br>- TextDomainManager allKnownDomains do: [:domain |
<br>- translation := self translatedInDomain: domain.
<br>- self = translation ifFalse: [^translation]].
<br>- ^self!
<br>
<br>Item was changed:
<br> ----- Method: String>>translatedInDomain: (in category '*System-Localization') -----
<br> translatedInDomain: aDomainName
<br>+
<br>+ ^ self
<br>+ translatedTo: LocaleID current
<br>+ inDomain: aDomainName!
<br>- | translation |
<br>- translation := self translatedTo: LocaleID current inDomain: aDomainName.
<br>- self == translation ifTrue: [^self translatedInAllDomains].
<br>- ^translation
<br>- !
<br>
<br>Item was removed:
<br>- ----- Method: String>>translatedInDomain:or: (in category '*System-Localization') -----
<br>- translatedInDomain: aDomainName or: anotherDomainName
<br>- | translation |
<br>- translation := self translatedTo: LocaleID current inDomain: aDomainName.
<br>- self == translation ifTrue: [^self translatedInDomain: anotherDomainName].
<br>- ^translation
<br>- !
<br>
<br>Item was changed:
<br> ----- Method: String>>translatedTo: (in category '*System-Localization') -----
<br> translatedTo: localeID
<br> "answer the receiver translated to the given locale id"
<br>+
<br>+ ^ self
<br>+ translatedTo: localeID
<br>+ inDomain: (TextDomainManager domainOfMethod: thisContext sender method)!
<br>- ^ self translatedTo: localeID inDomain: (TextDomainManager domainOfMethod: thisContext sender method).!
<br>
<br>Item was changed:
<br> ----- Method: String>>translatedTo:inDomain: (in category '*System-Localization') -----
<br> translatedTo: localeID inDomain: aDomainName
<br>+ "Answer the receiver translated to the given locale id in the textdomain. If no translation can be found, try to lookup all domains for a translation."
<br>- "answer the receiver translated to the given locale id in the textdomain"
<br>
<br>+ | translator translation |
<br>+ translator := NaturalLanguageTranslator availableForLocaleID: localeID.
<br>+ translation := translator translate: self inDomain: aDomainName.
<br>+ translation == self ifTrue: [^ translator translateInAllDomains: self].
<br>+ ^ translation!
<br>- ^ NaturalLanguageTranslator translate: self
<br>- toLocaleID: localeID
<br>- inDomain: aDomainName!
<br>
<br><br></div></blockquote>
</div></body>