Developer Forum
maximum length of a phraseKey?
How long can a phrase key be? and what are the character limitations? are there any banned characters?
Posted by Ryan 3 months ago
Can't get Localize.on("initialize") to fire after initialization
I'm trying to use the `on initialize` example that is mentioned in the docs: https://developers.localizejs.com/docs/library-api#initialize-1
```js
Localize.on("initialize", function(data) {
console.log("initialize: ");
console.log(data);
});
```
Here's my full script:
```js
(function(d, script) {
script = d.createElement('script');
script.type = 'text/javascript';
script.async = true;
script.onload = function(){
!function(a){if(!a.Localize){a.Localize={};for(var e=["translate","untranslate","phrase","initialize","translatePage","setLanguage","getLanguage","detectLanguage","getAvailableLanguages","untranslatePage","bootstrap","prefetch","on","off","hideWidget","showWidget","getSourceLanguage"],t=0;t<e.length;t++)a.Localize[e[t]]=function(){}}}(window);
Localize.initialize({
key: 'xxx',
rememberLanguage: true,
saveNewPhrasesFromSource: true,
});
Localize.on("initialize", function(data) {
console.log("initialize: ");
console.log(data);
});
};
script.src = 'https://global.localizecdn.com/localize.js';
d.getElementsByTagName('head')[0].appendChild(script);
}(document));
```
Right now ` Localize.initialize` works and I'm able to see the widget. The only thing not working is ` Localize.on("initialize", function(data) {`. It never fires the console.logs.
Thanks.
Posted by lance 5 months ago
Specify variable within a meta tag
Because I see no way of defining a variable without using a <var> tag which is not possible.
So our dynamic application with hundreds of thousands of titles all require a separate translation, right ?
Posted by Jody Sanders 5 months ago
Unable to write Unit test cases for Localize methods and its failed with issue
I have used localizejs on my Angular project and I started writing unit test cases for all my components but it failed with the below error as Localize global variable is found undefined on spec files.
Error:
ReferenceError: Localize is not defined
Let me know if I am doing any wrong implementation of my test cases in respect to Localize.
Thanks
Posted by Dhanesh Gosai 7 months ago
Can we create a way to avoid sending filenames to the dashboard
Is there a way as a developer when writing the website without access to the dashboard that I can avoid the phrases I am writing from being sent to the localise.js dashboard?
For example, filenames or system logs should not be sent to the localize dashboard.
Posted by Jacob Maschler 9 months ago
Is Localize compatible with SSRS?
We have SSRS reports generated in our application, but localize does not identify the words inside report. How can we go about it?
Posted by Sakshi B over 1 year ago
Identify language
Is there any way where whenever we change the language in application by Localize widget, an event must be fired so that according to the language set, I can do changes to my UI or content?
Posted by Sakshi B over 1 year ago
Search by phrase text API
Is there an API end-point that could be used to search for phrases by text? It is not feasible to get all phrases via `/phrases` and go one by one to find the phrase I'm interested in so that I can update its translation.
I can see there's an internal API used by the In-Context Editor to get a phrase by exact match, would this be made available in the public API?
Posted by Jaromir almost 2 years ago
Another date formatting question
We have many places in our application where we display the date in the following format:
01 Jan 2021
(DD MMM YYYY)
Is there a way we can mark these instances in HTML with an attribute or something that would let Localize know that it should translate it? Currently every date is getting put in our Pending queue.
I see this discussion from a while back but don't know if any progress had been made on it?
https://help.localizejs.com/discuss/5dcb4c0682dc230072c71f27
Thank you,
Justin
Posted by Justin about 2 years ago
Localize Month Year combinations?
We have the following phrases we'd like translated:
May 2021
May 2020
May 2019
etc....
Next year, of course, there will be a May 2022. Without having to go in and approve each of those individually, how can we localize "May NNNN"?
I tried using variables using:
"May {{year}}"
Unfortunately it also catches phrases like the following:
"May we contact you via email"
Thank you,
Justin
Posted by Justin about 2 years ago