mirror of
https://github.com/inventree/inventree-app.git
synced 2026-11-25 07:02:55 +00:00
Fix hard-coded strings (#938)
This commit is contained in:
1 parent
ed9590cddf
commit
02cf76aca5
9 files changed
+97
-14
No files matched your search
+3
-3
@@ -315,7 +315,7 @@ class APIFormField {
|
||||
default:
|
||||
return ListTile(
|
||||
title: Text(
|
||||
"Unsupported field type: '${type}' for field '${name}'",
|
||||
L10().unsupportedFieldType(type, name),
|
||||
style: TextStyle(color: COLOR_DANGER, fontStyle: FontStyle.italic),
|
||||
),
|
||||
);
|
||||
@@ -833,10 +833,10 @@ class APIFormField {
|
||||
default:
|
||||
return ListTile(
|
||||
title: Text(
|
||||
"Unsupported model",
|
||||
L10().unsupportedModel,
|
||||
style: TextStyle(fontWeight: FontWeight.bold, color: COLOR_DANGER),
|
||||
),
|
||||
subtitle: Text("Model '${model}' rendering not supported"),
|
||||
subtitle: Text(L10().unsupportedModelDetail(model)),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -470,7 +470,7 @@ class InvenTreeStockItem extends InvenTreeModel {
|
||||
|
||||
String serialOrQuantityDisplay() {
|
||||
if (isSerialized()) {
|
||||
return "SN ${serialNumber}";
|
||||
return L10().serialNumberShort(serialNumber);
|
||||
} else if (allocated > 0) {
|
||||
return "${available} / ${quantity}";
|
||||
} else {
|
||||
@@ -480,7 +480,7 @@ class InvenTreeStockItem extends InvenTreeModel {
|
||||
|
||||
String get locationName {
|
||||
if (locationId == -1 || !jsondata.containsKey("location_detail")) {
|
||||
return "Unknown Location";
|
||||
return L10().locationUnknown;
|
||||
}
|
||||
|
||||
String loc = getString("name", subKey: "location_detail");
|
||||
@@ -656,7 +656,7 @@ class InvenTreeStockLocation extends InvenTreeModel {
|
||||
String p = psplit.join("/");
|
||||
|
||||
if (p.isEmpty) {
|
||||
p = "Top level stock location";
|
||||
p = L10().stockTopLevel;
|
||||
}
|
||||
|
||||
return p;
|
||||
|
||||
+67
-1
@@ -2119,5 +2119,71 @@
|
||||
"@currency": {},
|
||||
|
||||
"priceBreaks": "Price Breaks",
|
||||
"@priceBreaks": {}
|
||||
"@priceBreaks": {},
|
||||
|
||||
"appBuild": "Build",
|
||||
"@appBuild": {
|
||||
"description": "Application build number label (e.g. 1.2.3 - Build 45)"
|
||||
},
|
||||
|
||||
"locationUnknown": "Unknown Location",
|
||||
"@locationUnknown": {},
|
||||
|
||||
"partDetailMissing": "Missing part detail",
|
||||
"@partDetailMissing": {},
|
||||
|
||||
"quantityExceedsMax": "Quantity must not exceed {max}",
|
||||
"@quantityExceedsMax": {
|
||||
"placeholders": {
|
||||
"max": {
|
||||
"type": "String"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
"reset": "Reset",
|
||||
"@reset": {},
|
||||
|
||||
"serialNumberShort": "SN {serial}",
|
||||
"@serialNumberShort": {
|
||||
"description": "Abbreviated serial number",
|
||||
"placeholders": {
|
||||
"serial": {
|
||||
"type": "String"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
"supplierPartMissing": "Supplier part not defined",
|
||||
"@supplierPartMissing": {},
|
||||
|
||||
"unsupportedFieldType": "Unsupported field type: '{type}' for field '{field}'",
|
||||
"@unsupportedFieldType": {
|
||||
"placeholders": {
|
||||
"type": {
|
||||
"type": "String"
|
||||
},
|
||||
"field": {
|
||||
"type": "String"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
"unsupportedModel": "Unsupported model",
|
||||
"@unsupportedModel": {},
|
||||
|
||||
"unsupportedModelDetail": "Rendering not supported for model '{model}'",
|
||||
"@unsupportedModelDetail": {
|
||||
"placeholders": {
|
||||
"model": {
|
||||
"type": "String"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
"zoomIn": "Zoom In",
|
||||
"@zoomIn": {},
|
||||
|
||||
"zoomOut": "Zoom Out",
|
||||
"@zoomOut": {}
|
||||
}
|
||||
@@ -208,7 +208,9 @@ class InvenTreeAboutWidget extends StatelessWidget {
|
||||
tiles.add(
|
||||
ListTile(
|
||||
title: Text(L10().version),
|
||||
subtitle: Text("${info.version} - Build ${info.buildNumber}"),
|
||||
subtitle: Text(
|
||||
"${info.version} - ${L10().appBuild} ${info.buildNumber}",
|
||||
),
|
||||
leading: Icon(TablerIcons.info_circle),
|
||||
trailing: UpdateChecker().newVersionAvailable
|
||||
? Icon(TablerIcons.alert_circle, color: COLOR_WARNING)
|
||||
|
||||
@@ -208,7 +208,7 @@ class QuantityField extends TextFormField {
|
||||
|
||||
if (quantity <= 0) return L10().quantityPositive;
|
||||
if ((max != null) && (quantity > max)) {
|
||||
return "Quantity must not exceed ${max}";
|
||||
return L10().quantityExceedsMax(max.toString());
|
||||
}
|
||||
|
||||
return null;
|
||||
|
||||
@@ -101,7 +101,7 @@ class _PaginatedPOLineListState
|
||||
return ListTile(
|
||||
title: Text(L10().error),
|
||||
subtitle: Text(
|
||||
"supplier part not defined",
|
||||
L10().supplierPartMissing,
|
||||
style: TextStyle(color: COLOR_DANGER),
|
||||
),
|
||||
);
|
||||
|
||||
@@ -86,7 +86,7 @@ class _PaginatedSOLineListState
|
||||
return ListTile(
|
||||
title: Text(L10().error),
|
||||
subtitle: Text(
|
||||
"Missing part detail",
|
||||
L10().partDetailMissing,
|
||||
style: TextStyle(color: COLOR_DANGER),
|
||||
),
|
||||
);
|
||||
|
||||
@@ -69,7 +69,7 @@ class _ImageCropperWidgetState extends State<ImageCropperWidget> {
|
||||
IconButton(
|
||||
icon: Icon(TablerIcons.refresh),
|
||||
onPressed: () => cropController.reset(),
|
||||
tooltip: "Reset",
|
||||
tooltip: L10().reset,
|
||||
),
|
||||
|
||||
// Zoom out button - scales to 75% of current size
|
||||
@@ -77,7 +77,7 @@ class _ImageCropperWidgetState extends State<ImageCropperWidget> {
|
||||
icon: Icon(TablerIcons.zoom_out),
|
||||
onPressed: () =>
|
||||
cropController.addTransition(CropImageData(scale: 0.75)),
|
||||
tooltip: "Zoom Out",
|
||||
tooltip: L10().zoomOut,
|
||||
),
|
||||
|
||||
// Zoom in button - scales to 133% of current size
|
||||
@@ -85,7 +85,7 @@ class _ImageCropperWidgetState extends State<ImageCropperWidget> {
|
||||
icon: Icon(TablerIcons.zoom_in),
|
||||
onPressed: () =>
|
||||
cropController.addTransition(CropImageData(scale: 1.33)),
|
||||
tooltip: "Zoom In",
|
||||
tooltip: L10().zoomIn,
|
||||
),
|
||||
|
||||
// Rotate button
|
||||
|
||||
@@ -238,6 +238,21 @@ void main() {
|
||||
});
|
||||
});
|
||||
|
||||
group("Stock Location:", () {
|
||||
test("Path", () async {
|
||||
var location = InvenTreeStockLocation.fromJson({
|
||||
"pathstring": "Warehouse/Shelf/Bin",
|
||||
});
|
||||
|
||||
expect(location.parentPathString, equals("Warehouse/Shelf"));
|
||||
|
||||
location = InvenTreeStockLocation.fromJson({"pathstring": "Warehouse"});
|
||||
|
||||
// Translated string (previously hard-coded)
|
||||
expect(location.parentPathString, equals(L10().stockTopLevel));
|
||||
});
|
||||
});
|
||||
|
||||
group("Part:", () {
|
||||
test("Full Name", () async {
|
||||
expect(
|
||||
|
||||
Reference in new issue
Block a user