Skip to content

Commit

Permalink
Merge pull request #1346 from SeasideSt/gettext-testing-improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
jbrichau authored Nov 13, 2022
2 parents 4211f09 + abbf1fd commit 3bae043
Show file tree
Hide file tree
Showing 49 changed files with 241 additions and 186 deletions.
7 changes: 1 addition & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,7 @@ jobs:
continue-on-error: ${{ matrix.experimental }}
name: ${{ matrix.smalltalk }}
steps:
- name: Get current date
id: date
run: echo "::set-output name=date::$(date +'%Y-%m-%dT%H:%M:%S')"
- name: Log date
run: echo "${{ steps.date.outputs.date }}"
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
ref: ${{ github.event.workflow_dispatch.ref }}
- uses: hpi-swa/setup-smalltalkCI@v1
Expand Down
5 changes: 3 additions & 2 deletions repository/Seaside-Gettext-Core.package/.filetree
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"noMethodMetaData" : true,
"separateMethodMetaAndSource" : false,
"useCypressPropertiesFile" : true }
"noMethodMetaData" : true,
"useCypressPropertiesFile" : true
}
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
{
"name" : "GRPackage" }
"name" : "GRPackage"
}
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
{
"name" : "GRPlatform" }
"name" : "GRPlatform"
}
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
{
"category" : "Seaside-Gettext-Core",
"classinstvars" : [
],
"classvars" : [
],
"commentStamp" : "",
"instvars" : [
],
"name" : "GetTextSucessfulTranslationResult",
"pools" : [
],
"super" : "GetTextTranslationResult",
"type" : "normal" }
"category" : "Seaside-Gettext-Core",
"classinstvars" : [ ],
"pools" : [ ],
"classvars" : [ ],
"instvars" : [ ],
"name" : "GetTextSucessfulTranslationResult",
"type" : "normal"
}
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
{
"category" : "Seaside-Gettext-Core",
"classinstvars" : [
],
"classvars" : [
],
"commentStamp" : "",
"super" : "Object",
"category" : "Seaside-Gettext-Core",
"classinstvars" : [ ],
"pools" : [ ],
"classvars" : [ ],
"instvars" : [
"original",
"translation" ],
"translation"
],
"name" : "GetTextTranslationResult",
"pools" : [
],
"super" : "Object",
"type" : "normal" }
"type" : "normal"
}
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
{
"category" : "Seaside-Gettext-Core",
"classinstvars" : [
],
"classvars" : [
],
"commentStamp" : "",
"instvars" : [
],
"name" : "GetTextUnsucessfulTranslationResult",
"pools" : [
],
"super" : "GetTextTranslationResult",
"type" : "normal" }
"category" : "Seaside-Gettext-Core",
"classinstvars" : [ ],
"pools" : [ ],
"classvars" : [ ],
"instvars" : [ ],
"name" : "GetTextUnsucessfulTranslationResult",
"type" : "normal"
}
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
{
"name" : "String" }
"name" : "String"
}
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
{
"name" : "WAApplication" }
"name" : "WAApplication"
}
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
{
"category" : "Seaside-Gettext-Core",
"classinstvars" : [
],
"classvars" : [
],
"commentStamp" : "JohanBrichau 7/23/2022 16:35",
"instvars" : [
],
"name" : "WACurrentLocalizationContext",
"pools" : [
],
"super" : "WADynamicVariable",
"type" : "normal" }
"category" : "Seaside-Gettext-Core",
"classinstvars" : [ ],
"pools" : [ ],
"classvars" : [ ],
"instvars" : [ ],
"name" : "WACurrentLocalizationContext",
"type" : "normal"
}
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
{
"category" : "Seaside-Gettext-Core",
"classinstvars" : [
],
"classvars" : [
],
"commentStamp" : "",
"instvars" : [
],
"name" : "WAGetTextConfiguration",
"pools" : [
],
"super" : "WASystemConfiguration",
"type" : "normal" }
"category" : "Seaside-Gettext-Core",
"classinstvars" : [ ],
"pools" : [ ],
"classvars" : [ ],
"instvars" : [ ],
"name" : "WAGetTextConfiguration",
"type" : "normal"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
translators registry
addTranslator: aTranslator for: anApplicationName
"Register translator for the named application"
TranslatorRegistry
at: anApplicationName
put: aTranslator
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
translators registry
addTranslatorFor: anApplicationName fromFiles: aCollectionOfMOFiles
"Create and register a translator for the named application with given gettext translation files"
self
addTranslator: (self newFromMOFiles: aCollectionOfMOFiles)
for: anApplicationName
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
translators registry
addTranslatorFor: anApplicationName fromFilesIn: aDirectoryPathString
"Create and register a translator for the named application with gettext translation files located in the given directory.
The argument directory is the top directory of the Gettext translation filestructure."
self
addTranslator: (self newFromMOFilesIn: aDirectoryPathString forName: anApplicationName)
for: anApplicationName

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
instance creation
newFromMOFiles: aCollectionOfMOFiles
| translator |
translator := self new.
aCollectionOfMOFiles do:[ :moFile |
translator addMOFile: moFile forLocaleID: moFile localeId ].
^ translator
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
private
addMOFile: moFile forLocaleID: localeId
^ moFilePerLocaleId
at: localeId
put: moFile
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
private
addMOFileFromPath: pathString forName: anApplicationName
| locale fileName |
locale := WALocale fromString: (GRPlatform current localNameOf: pathString).
fileName := String
streamContents: [ :str |
str
nextPutAll: pathString;
nextPutAll: GRPlatform current pathSeparator;
nextPutAll: 'LC_MESSAGES';
nextPutAll: GRPlatform current pathSeparator;
nextPutAll: anApplicationName;
nextPutAll: '.mo' ].
^ moFilePerLocaleId
at: locale localeId
put: (WAMOFile new initializeFromFile: fileName localeId: locale localeId)

| locale fileName |
locale := WALocale fromString: (GRPlatform current localNameOf: pathString).
fileName := String streamContents: [ :str |
str
nextPutAll: pathString;
nextPutAll: GRPlatform current pathSeparator;
nextPutAll: 'LC_MESSAGES';
nextPutAll: GRPlatform current pathSeparator;
nextPutAll: anApplicationName;
nextPutAll: '.mo' ].
^ self
addMOFile: (WAMOFile new initializeFromFile: fileName localeId: locale localeId)
forLocaleID: locale localeId
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
initialization
initialize
super initialize.
moFilePerLocaleId := Dictionary new.
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
initialization
initializeFromMOFilesIn: aDirectoryPathString forName: anApplicationName
self initialize.
moFilePerLocaleId := Dictionary new.
(GRPlatform current directoriesIn: aDirectoryPathString)
do: [ :dirPathString | self addMOFileFromPath: dirPathString forName: anApplicationName ]
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
{
"commentStamp" : "MelvinRoest 3/25/2022 14:19",
"super" : "Object",
"category" : "Seaside-Gettext-Core",
"classinstvars" : [
],
"classinstvars" : [ ],
"pools" : [ ],
"classvars" : [
"TranslatorRegistry" ],
"commentStamp" : "MelvinRoest 3/25/2022 14:19",
"TranslatorRegistry"
],
"instvars" : [
"moFilePerLocaleId" ],
"moFilePerLocaleId"
],
"name" : "WAGetTextTranslator",
"pools" : [
],
"super" : "Object",
"type" : "normal" }
"type" : "normal"
}
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
{
"category" : "Seaside-Gettext-Core",
"classinstvars" : [
],
"classvars" : [
],
"commentStamp" : "",
"super" : "WAObject",
"category" : "Seaside-Gettext-Core",
"classinstvars" : [ ],
"pools" : [ ],
"classvars" : [ ],
"instvars" : [
"key" ],
"key"
],
"name" : "WALazyTranslatedString",
"pools" : [
],
"super" : "WAObject",
"type" : "normal" }
"type" : "normal"
}
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
{
"category" : "Seaside-Gettext-Core",
"classinstvars" : [
],
"classvars" : [
],
"commentStamp" : "MelvinRoest 3/25/2022 11:23",
"super" : "WAObject",
"category" : "Seaside-Gettext-Core",
"classinstvars" : [ ],
"pools" : [ ],
"classvars" : [ ],
"instvars" : [
"translator",
"locale" ],
"locale"
],
"name" : "WALocalizationContext",
"pools" : [
],
"super" : "WAObject",
"type" : "normal" }
"type" : "normal"
}
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
{
"category" : "Seaside-Gettext-Core",
"classinstvars" : [
],
"classvars" : [
],
"commentStamp" : "MelvinRoest 3/25/2022 12:09",
"instvars" : [
],
"name" : "WALocalizationContextFilter",
"pools" : [
],
"super" : "WARequestFilter",
"type" : "normal" }
"category" : "Seaside-Gettext-Core",
"classinstvars" : [ ],
"pools" : [ ],
"classvars" : [ ],
"instvars" : [ ],
"name" : "WALocalizationContextFilter",
"type" : "normal"
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ initializeFromFile: aFileName localeId: aLocaleString
"Entry point for loading translations. All of strings are loaded. Translation strings are converted to internal string format on load time.
Original string/index pairs are registerd to Dictionary on load time."
self initialize.
localeString := aLocaleString.
localeId := aLocaleString.
fileName := aFileName.
GRPlatform current
readFileStreamOn: aFileName
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
initialization
initializeFromStream: aStream localeId: aLocaleString
self initialize.
localeString := aLocaleString.
localeId := aLocaleString.
self privateLoadStream: aStream
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
accessing
localeId
^ localeId
Loading

0 comments on commit 3bae043

Please sign in to comment.