Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 0 additions & 59 deletions astro.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -20,63 +20,4 @@ export default defineConfig({
},

integrations: [sitemap()],
redirects: {
'/tuts0101-getting-started': '/tutorial/tuts0101-getting-started',
'/tutorial/tuts0102-creating-a-module': '/tutorial/tuts0102-building-your-first-analysis',
'/tutorial/tuts0103-creating-an-analysis': '/tutorial/tuts0102-building-your-first-analysis',
'/tutorial/tuts0104-implementing-an-analysis': '/tutorial/tuts0103-implementing-an-analysis',
'/tutorial/tuts0105-debugging-an-analysis': '/tutorial/tuts0104-input-checks',
'/tutorial/tuts0204-debugging-an-analysis': '/tutorial/tuts0104-input-checks',
'/tutorial/tuts0107-distributing-modules': '/tutorial/tuts0110-distributing-modules',
'/tutorial/tuts0111-summary': '/tutorial/tuts0108-getting-started-summary',
'/tutorial/tuts0104-results-mental-model': '/tutorial/tuts0105-results-mental-model',
'/tutorial/tuts0105-creating-rich-results': '/tutorial/tuts0106-creating-rich-results',
'/tutorial/tuts0106-adding-plots': '/tutorial/tuts0107-adding-plots',
'/tutorial/tuts0107-getting-started-summary': '/tutorial/tuts0108-getting-started-summary',
'/tutorial/tuts0108-unit-testing': '/tutorial/tuts0109-unit-testing',
'/tutorial/tuts0109-distributing-modules': '/tutorial/tuts0110-distributing-modules',
'/tutorial/tuts0110-additional-notes': '/tutorial/tuts0111-additional-notes',
'/tutorial/tuts0108-additional-notes': '/tutorial/tuts0111-additional-notes',
'/tuts0201-dynamic-tables': '/tutorial/tuts0201-dynamic-tables',
'/tuts0201-data-binding': '/tutorial/tuts0201-dynamic-tables',
'/tuts0202-handling-data': '/tutorial/tuts0202-handling-data',
'/tuts0203-state': '/tutorial/tuts0203-state',
'/tutorial/tuts0204-advanced-plots': '/tutorial/tuts0301-image-state-performance',
'/tutorial/tuts0205-plot-themes': '/tutorial/tuts0302-plot-themes',
'/api_actions': '/api/actions',
'/api_analysis-definition': '/api/analysis-definition',
'/api_i18n': '/api/i18n',
'/api_image-sizing': '/tutorial/tuts0303-responsive-image-sizing',
'/api/image-sizing': '/tutorial/tuts0303-responsive-image-sizing',
'/api_module-definition': '/api/module-definition',
'/api_notices': '/api/notices',
'/api_results-definition': '/api/results-definition',
'/api_results-elements': '/api/results-elements',
'/api_table': '/api/table',
'/api_ui-definition': '/api/ui-definition',
'/ui-basecontrol': '/ui/basecontrol',
'/ui-basic-design': '/ui/basic-design',
'/ui-advanced-design': '/ui/advanced-design',
'/ui-advanced-customisation': '/ui/advanced-customisation',
'/ui-checkbox': '/ui/checkbox',
'/ui-collapsebox': '/ui/collapsebox',
'/ui-combobox': '/ui/combobox',
'/ui-custom-format': '/ui/custom-format',
'/ui-label': '/ui/label',
'/ui-layoutbox': '/ui/layoutbox',
'/ui-listbox': '/ui/listbox',
'/ui-optioncontrol': '/ui/optioncontrol',
'/ui-parentcontrol': '/ui/parentcontrol',
'/ui-radiobutton': '/ui/radiobutton',
'/ui-standard-formats': '/ui/standard-formats',
'/ui-supplier': '/ui/supplier',
'/ui-targetlayoutbox': '/ui/targetlayoutbox',
'/ui-termlabel': '/ui/termlabel',
'/ui-textbox': '/ui/textbox',
'/ui-variablelabel': '/ui/variablelabel',
'/ui-variablesupplier': '/ui/variablesupplier',
'/api_updates': '/misc/updates',
'/misc-library': '/tutorial/tuts0110-distributing-modules',
'/info_project-structure': '/misc/project-structure',
},
});
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
layout: ../layouts/BaseLayout.astro
title: "Getting Started"
type: article
description: "Learn how to set up your environment and install your first jamovi module using jmvtools."
---

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
layout: ../layouts/BaseLayout.astro
title: "Building Your First Analysis"
type: article
description: "Scaffold a jamovi module and define your first statistical analysis UI using YAML."
---

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
layout: ../layouts/BaseLayout.astro
title: "Implementing an Analysis"
type: article
description: "Write the R logic for your jamovi analysis using R6 classes and the jmvcore package."
---

Expand Down
1 change: 1 addition & 0 deletions src/content/docs/learn/tutorial/tuts0104-input-checks.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
layout: ../layouts/BaseLayout.astro
title: "Input Checks"
type: article
description: "Learn how to prevent errors when users haven't finished setting up their analysis using guard clauses."
---

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
layout: ../layouts/BaseLayout.astro
title: "The jamovi Results Model"
type: article
description: "Understand the hierarchical relationship between your R code and the jamovi results panel."
---

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
layout: ../layouts/BaseLayout.astro
title: "Creating Rich Results"
type: article
description: "Learn how to define and populate APA-formatted tables in your jamovi analysis results."
---

Expand Down
1 change: 1 addition & 0 deletions src/content/docs/learn/tutorial/tuts0107-adding-plots.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
layout: ../layouts/BaseLayout.astro
title: "Adding Plots"
type: article
description: "Learn how to integrate ggplot2 into your jamovi analysis using the State/Render model."
---

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
layout: ../layouts/BaseLayout.astro
title: "Summary & Next Steps"
type: article
description: "Review what you've learned in the Getting Started series and discover your next steps for building jamovi modules."
---

Expand Down
1 change: 1 addition & 0 deletions src/content/docs/learn/tutorial/tuts0109-unit-testing.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
layout: ../layouts/BaseLayout.astro
title: "Unit Testing your Analysis"
type: article
description: "Ensure your jamovi analysis is robust and accurate by writing automated tests using testthat."
---

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
layout: ../layouts/BaseLayout.astro
title: "Distributing Modules"
type: article
description: "Share your jamovi module with others by side-loading .jmo files or submitting to the jamovi library."
---

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
layout: ../layouts/BaseLayout.astro
title: "Additional Notes"
type: article
description: "Advanced tips on dependency management, performance optimization, and R namespace best practices."
---

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
layout: ../layouts/BaseLayout.astro
title: "The Analysis Lifecycle"
type: article
description: "Master the two-stage execution model of jamovi: .init() and .run()."
---

Expand Down
4 changes: 3 additions & 1 deletion src/content/docs/learn/tutorial/tuts0201-dynamic-tables.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
---
layout: ../layouts/BaseLayout.astro
title: "Dynamic Tables"
type: article
description: "Learn how to create jamovi tables with a dynamic number of rows using data-binding to user options."
---

In the previous tutorial series, we looked at [constructing and populating tables](/tutorial/tuts0105-creating-rich-results). The .r.yaml file contained:
In the previous tutorial series, we looked at [constructing and populating tables](/tutorial/tuts0106-creating-rich-results). The .r.yaml file contained:

```yaml
...
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
layout: ../layouts/BaseLayout.astro
title: "Advanced Table Techniques"
type: article
description: "Master complex results using the Three Levels of Table Initialization, Grouped Results, and Table Folding."
---

Expand Down
1 change: 1 addition & 0 deletions src/content/docs/learn/tutorial/tuts0202-handling-data.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
layout: ../layouts/BaseLayout.astro
title: Handling Data
type: article
description: "Master the Dual Nature of jamovi variables and learn how to correctly convert data for your R analyses."
---

Expand Down
2 changes: 2 additions & 0 deletions src/content/docs/learn/tutorial/tuts0203-state.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
---
layout: ../layouts/BaseLayout.astro
title: State
type: article
description: "Learn how to use state and the clearWith property in jamovi to improve performance by avoiding redundant calculations."
---

The analyses demonstrated in the tutorial series so far, have been completely *state*-less. This means that each time an analysis is run, (for example, in response to a user checking a checkbox) it runs the analysis from beginning to end. In many cases, this isn't very efficient. A user may run a t-test, and then select a checkbox requesting descriptives. Without *state*, an analysis will recalculate the t-test results every time the analysis is changed, even when the changed option has no impact on the t-test results.
Expand Down
99 changes: 99 additions & 0 deletions src/content/docs/learn/tutorial/tuts0204-translation.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
---
layout: ../layouts/BaseLayout.astro
title: Module Translation
description: Learn how to enable multi-language support in your jamovi module.
type: article
---

jamovi supports the translation of modules. Although R does provide a rudimentary translation system, it's unfortunately limited in several significant ways. Perhaps the most significant limitation is that an R process cannot change the language it is using 'on the fly'. As a result, jamovi has had to provide its own translation system.

## Enabling translations

By default, all strings in the `.a.yaml`, `.r.yaml`, and `.u.yaml` are available to be translated, and don't require any special treatment by module developers. As such, the main task for module developers in enabling translation in modules is to ensure strings used in `.R` source files can be translated accordingly. The most common strings that need to be translated typically error messages and warnings.

Strings are marked as translateable using the `.()` function from `jmvcore`. In order to use this without the `jmvcore::` prefix (i.e. allowing the more terse `.('Too few samples')`, rather than having to write `jmvcore::.('Too few samples')`), it's necessary to include the relevant import in the modules `NAMESPACE` file as follows:

```r
importFrom(jmvcore,.)
```

This done, it's simply a matter of wrapping strings that need to be translated in calls to `.()`. Wrapping strings with `.()` performs two roles:
1. It indicates to the `jamovi-compiler` or `jmvtools` that the surrounded string needs translating. This allows the compiler (or jmvtools) to extract the string and place it in a 'database' of strings to translate.
2. It performs the translation at runtime. The `.()` function looks up a database of translated strings at runtime, and if it finds one suitable for the present language, it will return that to the calling function.

### Recommendations

Translatable strings should not have trailing or leading spaces. Translators might not understand why they are there and may accidentally trim them off, leading to formatting issues in the UI.

**Avoid:**
```r
resids <- format(.('{}Residuals'), ifelse(std, .('Standardized '), ''))
```

**Recommended:**
```r
if (std) {
resids <- .('Standardized Residuals')
} else {
resids <- .('Residuals')
}
```

## Limitations: Accessing `self`

The `.()` function requires access to the analysis object (i.e. the `self` in `self$results$...`). In order to access the current analysis, the `.()` function looks for a variable named `self` in the calling function's environment.

For the most part, this happens transparently. If you call `.()` inside a member function of the analysis R6 class (like `.run()`), `self` is defined and it works perfectly.

### Auxiliary Functions

The exception is where the analysis calls auxiliary functions which are **not** members of the analysis R6 class. In these cases, you must pass `self` into the function explicitly.

**BAD (Will Fail):**
```r
makeSSString <- function(sstype) {
if (sstype == 1) {
# Error: .() cannot find 'self'
return(.('Type 1 Sum of Squares is not suitable for this data set'))
}
NULL
}

# R6 Class
.run=function() {
message <- makeSSString(sstype)
}
```

**GOOD:**
```r
makeSSString <- function(sstype, self) {
if (sstype == 1) {
# Success: 'self' is passed in explicitly
return(.('Type 1 Sum of Squares is not suitable for this data set'))
}
NULL
}

# R6 Class
.run=function() {
message <- makeSSString(sstype, self)
}
```

## Creating Translation Files

You can manage the translation catalogs using `jmvtools` from the R console:

```r
# Create the base catalog (POT file)
jmvtools::i18nCreate('catalog')

# Create a specific language file (e.g., 'de' for German)
jmvtools::i18nCreate('de')

# Update existing files after adding new strings to your code
jmvtools::i18nUpdate()
```

The jamovi library is also able to take care of much of this process for you. Feel free to reach out to the jamovi team to participate in the community translation efforts.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
layout: ../layouts/BaseLayout.astro
title: "Image State Performance"
type: article
description: "Optimize your jamovi module by avoiding the \"State\" anti-pattern and using data-driven rendering correctly."
---

Expand Down
1 change: 1 addition & 0 deletions src/content/docs/learn/tutorial/tuts0302-plot-themes.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
layout: ../layouts/BaseLayout.astro
title: "Plot Themes"
type: article
description: "Learn how jamovi automatically applies themes to your plots for a native look and feel."
---

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
layout: ../layouts/BaseLayout.astro
title: Responsive Image Sizing
type: article
description: Master the "Fixed vs. Stretchable" mental model to create plots that scale beautifully in jamovi.
---

Expand Down Expand Up @@ -95,4 +96,4 @@ if ( ! is.null(image[["setSize2"]])) {
- [ ] **Is my math dynamic?** Base your `heightM` or `widthM` on the number of variables or groups selected.
- [ ] **Did I account for both axes?** Remember that both width and height usually have fixed components.

**Next Step:** Once your analysis is visual and responsive, it's time to ensure it is robust with **[Unit Testing](/tutorial/tuts0108-unit-testing)**.
**Next Step:** Once your analysis is visual and responsive, it's time to ensure it is robust with **[Unit Testing](/tutorial/tuts0109-unit-testing)**.
2 changes: 2 additions & 0 deletions src/content/docs/learn/ui/advanced-customisation.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
---
layout: ../layouts/BaseLayout.astro
title: "Advanced customisation of the options UI"
type: article
description: "Learn how to use JavaScript to create dynamic and complex user interfaces for jamovi analyses, including custom event handlers and DOM manipulation."
output: html_document
---

Expand Down
2 changes: 2 additions & 0 deletions src/content/docs/learn/ui/advanced-design.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
---
layout: ../layouts/BaseLayout.astro
title: "Advanced UI Design"
type: article
description: "Explore advanced UI design in jamovi, including detailed mappings between option types and their corresponding UI controls."
output: html_document
---

Expand Down
4 changes: 3 additions & 1 deletion src/content/docs/learn/ui/basic-design.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
---
layout: ../layouts/BaseLayout.astro
title: "UI Design"
type: article
description: "Learn the fundamentals of designing user interfaces for jamovi analyses, including compiler modes, best practices, and layout controls."
output: html_document
---

UIs for jamovi analyses are defined in the .u.yaml file (A refresher on the files and the relationship between them is described [here](/tutorial/tuts0103-creating-an-analysis)). This describes what sort of control each option is represented by (i.e. a dropdown list, or some radio buttons), and the order and the layout in which they will appear.
UIs for jamovi analyses are defined in the .u.yaml file (A refresher on the files and the relationship between them is described [here](/tutorial/tuts0102-building-your-first-analysis)). This describes what sort of control each option is represented by (i.e. a dropdown list, or some radio buttons), and the order and the layout in which they will appear.

### `aggressive` vs `tame` compiler mode

Expand Down
Loading
Loading