2 changes: 2 additions & 0 deletions resources/function_help/Conversions-en_US
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<h3>Conversions Group</h3>
This group contains functions to convert on data type to another e.g string to integer, integer to string.
5 changes: 5 additions & 0 deletions resources/function_help/Fields-en_US
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<h3>Fields and values Group</h3>
Contains a list of fields from the layer.
<br><br>
Select the field name from the list then right-click to access menu with options to load sample values from the selected field.

2 changes: 2 additions & 0 deletions resources/function_help/Geometry-en_US
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<h3>Geometry Group</h3>
This group contains functions that operate on geometry objects e.g length, area.
2 changes: 2 additions & 0 deletions resources/function_help/Math-en_US
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<h3>Math Group</h3>
This group contains math functions e.g square root, sin and cos
2 changes: 2 additions & 0 deletions resources/function_help/Operators-en_US
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<h3>Operators Group</h3>
This group contains operators e.g + - *
1 change: 1 addition & 0 deletions resources/function_help/Record-en_US
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<h3>Record Group</h3>
2 changes: 2 additions & 0 deletions resources/function_help/String-en_US
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<h3>String Group</h3>
This group contains functions that operate on strings e.g replace, convert to upper case.
12 changes: 9 additions & 3 deletions src/gui/qgsexpressionbuilderwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -409,6 +409,11 @@ QString QgsExpressionBuilderWidget::loadFunctionHelp( QgsExpressionItem* functio
QString helpContents;
QFile file( fullHelpPath );
// check to see if the localized version exists

QString missingError = tr("<h3>Opps! QGIS can't find help for this function.</h3>"
"The help file for %1 was not found for your language<br>"
"If you would like to create it, contact the QGIS development team"
).arg( functionName->text() );
if ( !file.exists() )
{
// change the file name to the en_US version (default)
Expand All @@ -419,14 +424,14 @@ QString QgsExpressionBuilderWidget::loadFunctionHelp( QgsExpressionItem* functio
// translate this for us message
if ( !lang.contains( "en_" ) )
{
helpContents = "<i>" + tr( "This help file is not available in your language %1. If you would like to translate it, please contact the QGIS development team." ).arg( lang ) + "</i><hr />";
helpContents = missingError;
}

}

if ( !file.open( QIODevice::ReadOnly | QIODevice::Text ) )
{
helpContents = tr( "This help file does not exist for your language:<p><b>%1</b><p>If you would like to create it, contact the QGIS development team" )
.arg( fullHelpPath );
helpContents = missingError;
}
else
{
Expand All @@ -438,6 +443,7 @@ QString QgsExpressionBuilderWidget::loadFunctionHelp( QgsExpressionItem* functio
helpContents += line;
}
}

file.close();

// Set the browser text to the help contents
Expand Down
11 changes: 8 additions & 3 deletions src/helpviewer/qgshelpviewer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,12 @@ void QgsHelpViewer::loadContext( const QString &contextId )
// get the help content and title from the localized file
QString helpContents;
QFile file( fullHelpPath );

QString missingError = tr("<h3>Opps! QGIS can't find help for this form.</h3>"
"The help file for %1 was not found for your language<br>"
"If you would like to create it, contact the QGIS development team"
).arg( contextId );

// check to see if the localized version exists
if ( !file.exists() )
{
Expand All @@ -137,13 +143,12 @@ void QgsHelpViewer::loadContext( const QString &contextId )
// translate this for us message
if ( !lang.contains( "en_" ) )
{
helpContents = "<i>" + tr( "This help file is not available in your language %1. If you would like to translate it, please contact the QGIS development team." ).arg( lang ) + "</i><hr />";
helpContents = missingError;
}
}
if ( !file.open( QIODevice::ReadOnly | QIODevice::Text ) )
{
helpContents = tr( "This help file does not exist for your language:<p><b>%1</b><p>If you would like to create it, contact the QGIS development team" )
.arg( fullHelpPath );
helpContents = missingError;
}
else
{
Expand Down
3 changes: 3 additions & 0 deletions src/helpviewer/qgshelpviewerbase.ui
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@
<bool>true</bool>
</property>
<layout class="QGridLayout" name="gridLayout">
<property name="margin">
<number>0</number>
</property>
<item row="0" column="0">
<widget class="QWebView" name="webView">
<property name="url">
Expand Down