1
1
package io .github .jy95 .fds .r4 .translators ;
2
2
3
3
import com .ibm .icu .text .MessageFormat ;
4
+ import io .github .jy95 .fds .common .functions .UnitsOfTimeFormatter ;
4
5
import io .github .jy95 .fds .common .translators .PeriodPeriodMax ;
5
6
import io .github .jy95 .fds .r4 .config .FDSConfigR4 ;
6
7
import org .hl7 .fhir .r4 .model .Dosage ;
@@ -23,9 +24,9 @@ public class PeriodPeriodMaxR4 implements PeriodPeriodMax<FDSConfigR4, Dosage> {
23
24
protected final MessageFormat periodMsg ;
24
25
25
26
/**
26
- * The resource bundle containing localized strings for translation .
27
+ * The configuration object used by this API .
27
28
*/
28
- private final ResourceBundle bundle ;
29
+ private final FDSConfigR4 config ;
29
30
30
31
/**
31
32
* Constructor for {@code PeriodPeriodMaxR4}.
@@ -34,7 +35,7 @@ public class PeriodPeriodMaxR4 implements PeriodPeriodMax<FDSConfigR4, Dosage> {
34
35
* @param bundle a {@link java.util.ResourceBundle} object
35
36
*/
36
37
public PeriodPeriodMaxR4 (FDSConfigR4 config , ResourceBundle bundle ) {
37
- this .bundle = bundle ;
38
+ this .config = config ;
38
39
this .periodMaxMsg = getPeriodMaxMsg (bundle , config .getLocale ());
39
40
this .periodMsg = getPeriodMsg (bundle , config .getLocale ());
40
41
}
@@ -73,7 +74,7 @@ public String turnPeriodAndPeriodMaxToString(Dosage dosage) {
73
74
var periodMin = repeat .getPeriod ();
74
75
var periodUnit = repeat .getPeriodUnit ().toCode ();
75
76
76
- var unitText = getUnit ( bundle , periodUnit , periodMax );
77
+ var unitText = UnitsOfTimeFormatter . formatWithoutCount ( config . getLocale () , periodUnit , periodMax );
77
78
return formatPeriodAndPeriodMaxText (periodMin , periodMax , unitText );
78
79
}
79
80
@@ -85,7 +86,7 @@ public String turnPeriodToString(Dosage dosage) {
85
86
var period = repeat .getPeriod ();
86
87
var periodUnit = repeat .getPeriodUnit ().toCode ();
87
88
88
- var unitText = getUnit ( bundle , periodUnit , period );
89
+ var unitText = UnitsOfTimeFormatter . formatWithoutCount ( config . getLocale () , periodUnit , period );
89
90
return formatPeriodText (period , unitText );
90
91
}
91
92
0 commit comments