-
-
Notifications
You must be signed in to change notification settings - Fork 273
Project localization/translation support #6645
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
🎉 Ta-daaa, freshly created APKs are available for d8f269b: arm64-android |
Since we do expose and rely on project titles and other layer metadata quite a lot in our UI, this was a very good reason to improve project translation upstream and add support for the localization of basic project and layer metadata. The result is here: qgis/QGIS#63168 🥳 |
else if ( suffix == QStringLiteral( "qgs" ) || suffix == QStringLiteral( "qgz" ) ) | ||
{ | ||
QRegularExpression re( QStringLiteral( "(.*)_[A-Za-z]{2}" ) ); | ||
QRegularExpressionMatch match = re.match( fi.completeBaseName() ); | ||
if ( match.hasMatch() ) | ||
{ | ||
if ( items.contains( QStringLiteral( "%1.qgs" ).arg( match.captured( 1 ) ), Qt::CaseInsensitive ) || items.contains( QStringLiteral( "%1.qgz" ).arg( match.captured( 1 ) ), Qt::CaseInsensitive ) ) | ||
{ | ||
// Skip translated project, users should always use the original project | ||
continue; | ||
} | ||
} | ||
} | ||
else if ( suffix == QStringLiteral( "zip" ) ) | ||
{ | ||
if ( item.endsWith( QStringLiteral( "_attachments.zip" ), Qt::CaseInsensitive ) ) | ||
{ | ||
const QString reducedItemName = item.mid( 0, item.size() - 16 ); | ||
if ( items.contains( QStringLiteral( "%1.qgs" ).arg( reducedItemName ), Qt::CaseInsensitive ) || items.contains( QStringLiteral( "%1.qgz" ).arg( reducedItemName ), Qt::CaseInsensitive ) ) | ||
{ | ||
// Skip project attachments sidecar file | ||
continue; | ||
} | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@nirvn , could you please elaborate a bit more on what the code is doing?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mohsenD98 , it's skipping sidecar files that QGIS generates alongside the main .qgs project file. The sidecar files are of no use and should only be accessed by opening the main project.qgs file.
This PR implements support for localized / translated project files so that QField can speak a lot of languages too (background reading: https://www.opengis.ch/2018/09/11/qgis-speaks-a-lot-of-languages/). This also works with cloud projects, which is reallly nice.
Contrary to QGIS, we will always display a localized project if the _XX.qm file is present (i.e., we don't require users to overwrite / specify a locale). It will respect the phone / device's OS locale, or the one specified in QField settings panel.
Implements / fixes #5670