weblate | Web based localization tool with tight version control | Internationalization library
kandi X-RAY | weblate Summary
kandi X-RAY | weblate Summary
Web based localization tool with tight version control integration.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Creates the translation .
- Performs translation .
- Updates a translation from a unit .
- Check to see if the file revision has changed .
- Gets the counts for a given project .
- Bulk edit for the given unit_state
- Handles a service request .
- Discover available services .
- Gets the other units .
- Show a project .
weblate Key Features
weblate Examples and Code Snippets
git remote add weblate https://$USERNAME:$APIKEY@translate.nitrokey.com/git/nitrokey-documentation/index/
git remote update weblate
git merge weblate/master
Auto-merging locales/de/LC_MESSAGES/x230.po
CONFLICT (content): Merge conflict in locales/
sudo apt install bambam
man bambam
bambam
cd bambam-1.1.2
./bambam.py
quit
man ./bambam.6
sudo yunohost app install https://github.com/YunoHost-Apps/weblate_ynh/tree/testing --debug
or
sudo yunohost app upgrade weblate -u https://github.com/YunoHost-Apps/weblate_ynh/tree/testing --debug
data_obj = json.loads(re.search(r'window\._initialData\=(\{.+\});', script_text).group(1))
> data_obj['jobLocation']
Arlington, TX
> data_obj['localeData'][''][-1].split('\n')
['Pr
>>> print re.escape('яблуко*')
\я\б\л\у\к\о\*
Community Discussions
Trending Discussions on weblate
QUESTION
Is there any way to do a dry run of xgettext
on source files, in order to simply check if there are any differences compared to the current .pot
file?
I have set up a Github workflow that will run xgettext
on source files any time a change to a source file is pushed to the repository. The result is that often the change to the source file didn't change the translation strings, so the only difference in the resulting .pot
file is the Creation date, which gets updated every time xgettext
is run. This makes for unnecessary commits, and triggers unnecessary webhook calls to my weblate instance which picks up on an "updated" .pot
file, and winds up generating its own Pull Request with an "updated" .pot
file.
If there were a way to do a dry run and first check if there are any actual differences in the strings, I could avoid unnecessary commits and PRs from polluting my repo. Any ideas?
...ANSWER
Answered 2022-Jan-23 at 15:03I was able to add a filter to my Github workflow, checking whether there are any significant changes besides a simple update to the value of POT-Creation-Date
in the .pot
file. I added an id
to the step that takes care of running xgettext
, then after running xgettext
I save the count of significant lines changed in the pot file to a variable that will be accessible to the next step:
QUESTION
I'm scripting a Weblate (version 4.3.2) installation and I've successfully fetched existing localizations from Weblate REST API using curl
and pass the Authorization
Token
value from the Weblate profile settings (login, open profile menu from top right, select Settings
- API Access
and copy-paste the "personal API key").
In short, the GET /api/translations/(string:project)/(string:component)/(string:language)/file/
request works according to documentation at https://docs.weblate.org/en/weblate-4.3.2/api.html#get--api-translations-(string-project)-(string-component)-(string-language)-file- and I'm getting the expected results with pretty good performance.
However, the POST /api/translations/(string:project)/(string:component)/(string:language)/file/
request documented at https://docs.weblate.org/en/weblate-4.3.2/api.html#post--api-translations-(string-project)-(string-component)-(string-language)-file- always fails and results in following response:
ANSWER
Answered 2021-Dec-09 at 13:36Most likely method
or conflicts
parameters are wrong. The API code raises permission error in these cases, but it should rather tell user what is wrong.
The error messages should be more useful in the next release, I've improved this in https://github.com/WeblateOrg/weblate/commit/4abf2193ed57cb7822db804376c6adde9cccb753
QUESTION
Here's my situation : my team and I have a project using a front end framework. It works great and is correctly organized with a typical git workflow with master
, develop
and features/fixes
branches.
We now have an increasing need to add a large number of translations to our project (translations are located in a single folder). We decided to try out Weblate to manage them. Right now, Weblate has a full access to our entire git repository to push translations.
For security reasons, we want Weblate
to only have access to our translation folder. We thought we could create a git submodule for the translation and give weblate
an access to it.
Unfortunately, I am not sure of how we could easily integrate a submodule to our current workflow.
I thought of a solution but I am not sure it is possible : I want to create a submodule with a workflow similar to the main project. When a developer (or weblate) wants to update a translation, he has to create a feature branch on both the main project and the submodule and then merge both branch when the feature is finished.
I am not familiar with git submodules and there is probably a smarter way to do this so your thoughts on this would be very much appreciated :)
...ANSWER
Answered 2021-Sep-14 at 07:04The simplest approach would be to reference in your main project the translation folder/submodule, set to follow the latest commit from its main
branch.
That means at any point in your main repository, a git submodule update --remote
will update the submodule to its latest commit.
That way, you can have a pull-request/merge policy within your separate translation
repository, and, once reviewed and merged in its main branch, a submodule update --remote
in the main repository will get the latest revision of that submodule.
QUESTION
I'm using ini file for localisation. Actually almost the Joomla! format. I searched the Weblate documentation and read all about Gettext plural formulas for different languages. What I can't find is how to "tell" Weblate that a particular string id is a plural. I basically extended the ini to include something like this:
...ANSWER
Answered 2021-Aug-20 at 05:36The file format has to support plurals. The capabilities of supported formats are documented in https://docs.weblate.org/en/latest/formats.html#translation-types-capabilities
If you are inventing the own way of storing plurals, you would have to implement support for it in Weblate as well. Or just choose one of existing formats which are widely used.
QUESTION
I'm trying to solve a problem, where I have to translate strings using xslt.
I saw this: XSLT key() lookup and this: XSLT Conditional Lookup Table
but I'm not able to get it to work. I've tried to come up with the minimal example below which shows the problems that I'm facing. The "real" xsl is assembled from code snippets using a build process. This involves some constraints.
The inner structure of the translation lookup tables always is the same, since they are downloaded from a translation tool in flat xml format http://docs.translatehouse.org/projects/translate-toolkit/en/latest/formats/flatxml.html. I can only wrap them into distinct parent nodes which is what i tried using the "lu" namespace. The translation tables for all languages have to be stored inside the xsl, because different generations of xsl with different translations may exist next to each other. So no "sidecar" files.
Until now I can't get the key to work. The output of xsltproc is the following:
...ANSWER
Answered 2021-Jul-30 at 08:25There are two mistakes in your XSLT stylesheet that immediately jump out:
- The
xsl:key
element is allowed only at the top level, as a child of thexsl:stylesheet
element. - In XSLT 1.0, keys operate only on the current document. If you want to lookup from the stylesheet itself, you must change the context to the stylesheet document before calling the
key()
function. Here are two examples: https://stackoverflow.com/a/32440143/3016153
https://stackoverflow.com/a/30188334/3016153
I am afraid that's about all that can be said without a reproducible example.
--- added ---
So this means that I can't selectively define a key depending on language?
You cannot define a key conditionally - but you can define more than one key and select the one to use based on the specified language. Here's a simplified example:
XSLT 1.0
QUESTION
I am using a GitLab CI Runner with Docker.
My dockerfile looks as follows:
...ANSWER
Answered 2020-Nov-24 at 13:32I finally solved the issue through:
- Removing
USER ciuser
from the Dockerfile so that the runner is starting with theroot
user again - Changing the test command as follows
sudo -H -u ciuser bash -c "npm install && npm run test:cobertura"
so that it is executed by theciuser
as it is described in this post.
QUESTION
I'm using a hosted weblate.
I'm in the "Files" section of my component configuration. Below is my setup.
Translation files:
- File format: gettext PO file
- Filemask: src/translations/*.po
- Language filter: ^[^.]+$
Monolingual translations:
- All fields empty
- Edit base file checked
Adding new languages:
- Template for new translations: src/translations/template.pot
- Adding new translation: Create new language file
- Language code style: Default based on the file format
I can't validate these settings, I have an error below fields "Template for new translations" and "Adding new translation": The error is "Unrecognized base file for new translations".
I'm am 100% sure the pot file exists on the branch weblate is configured to use and also on master and that the path is correct.
Here are the first few lines of the pot file:
...ANSWER
Answered 2020-Aug-05 at 15:36The header of the file seems stripped. At least you should prepend following to make it syntactically valid:
QUESTION
Everytime we add a new translation string in Weblate via Web-GUI the iOS string is without quotes.
drawer_collect_enroll_i=Select what you want
but it should be
"drawer_collect_enroll_i"="Select what you want"
If I commit a 2nd time everything is corrected!!
Any solutions for this?
...ANSWER
Answered 2020-Jul-10 at 05:48You've also reported it at https://github.com/WeblateOrg/weblate/issues/4151, let's deal with the bug there...
QUESTION
We use Weblate in our mobile app CI environment. So far everything is awesome. Weblate runs in a docker environment (v4.1)
Now I want to improve the workflow.
I managed to create custom checks, these validate the use of Android/iOS placeholders (see sample below). Now the translator needs to know which platform he is working with to use the correct placeholder and dismiss the false-positive check.
Placeholder in use right now are %1$@
for iOS and %1$s
for Android
My question:
- Is there a better/general approach how I can teach my translators how to write placeholders?
- How can I write my check based on the file format (or translation file suffix, i.e .xml, .strings)? So I know, this is an android/xml file, and the placeholder should be
%1$s
NOT%1$@
Sample check
...ANSWER
Answered 2020-Jun-07 at 07:56I can see few approaches:
- In case these formats are generic to the file format, file a feature request so that it's included in future Weblate releases
- In case this affects just few strings, you can define the placeholders, you can utilize generic placeholders check in Weblate and let Weblate check and highlight them
- To limit check triggering only on some components, you can use translation flags, these can be set at component level
- In case you want to write custom check, it should probably also check if the format string is present in the source string, so something like:
QUESTION
In Weblate I find myself unable to edit the source strings in the GUI, because they are flagged as "read only". I imagine that a manual way would be to manually edit the source files and push them up, outside of Weblate. But that requires some understanding of the chosen format (gettext in my case).
Is there any way to do this in the GUI? I would prefer some way that propagates the change across all the languages.
...ANSWER
Answered 2020-Feb-03 at 09:11Currently, there is no way to do this inside Weblate for bilingual translation files. In these, the strings are extracted from the source code while doing some transformations (in your case using xgettext), so editing the source code is not a task that would be easy to automate inside Weblate.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install weblate
You can use weblate like any standard Python library. You will need to make sure that you have a development environment consisting of a Python distribution including header files, a compiler, pip, and git installed. Make sure that your pip, setuptools, and wheel are up to date. When using pip it is generally recommended to install packages in a virtual environment to avoid changes to the system.
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page