Related
If I copy something from textedit or web and paste it to localizable file it shows this compilation error. If I type those in localizable file it does not show any error. I am assuring you that I using the correct format and ';' in the file.
"New" = "New";
"In Progress" = "In Progress";
"Waiting" = "Waiting";
"Closed" = "Closed";
Use plutil from the Terminal:
you have to run it for each version of the localizable file. E.g
cd into your project root
cd eb.lproj - you can replace this with
any localisation you are working with.
plutil -lint Localizable.strings
When you run step 3, you will either be shown an error, telling you what is wrong with your file. Or you will be told the file is OK
Note that plutil output is bad, it seems it always says "Unexpected character at line 1" but above that output, it prints other stuff like missing semicolon on line 121, and that is the real error
For me, it was missing semi-colons. If you use a tool to generate .strings file, make sure there are no un-escaped quotes that may 'eat' the delimiting semi-colons.
pl < Localizable.strings
is better than plutil -lint Localizable.strings
Log will show something like this
2019-08-14 16:39:34.066 pl[21007:428513] CFPropertyListCreateFromXMLData(): Old-style plist parser: missing semicolon in dictionary on line 427. Parsing will be abandoned. Break on _CFPropertyListMissingSemicolon to debug.
2019-08-14 16:39:34.068 pl[21007:428513] CFPropertyListCreateFromXMLData(): Old-style plist parser: missing semicolon in dictionary on line 427. Parsing will be abandoned. Break on _CFPropertyListMissingSemicolon to debug.
2019-08-14 16:39:34.071 pl[21007:428513] *** Exception parsing ASCII property list: NSParseErrorException Error Domain=NSCocoaErrorDomain Code=3840 "Unexpected character / at line 1" UserInfo={NSDebugDescription=Unexpected character / at line 1, kCFPropertyListOldStyleParsingError=Error Domain=NSCocoaErrorDomain Code=3840 "Missing ';' on line 427" UserInfo={NSDebugDescription=Missing ';' on line 427}}
Fastest way to detect the line with the issued string is to :
right click the strings file and
then Open as/ASCII property list.
Xcode will immediately tell you in what line there's an error.
I know this question was asked long ago but my scenario and solution is little bit different.
Today I faced same issue but when I tried to check the issue using
plutil -lint Localizable.strings
I got OK status which means everything is fine, then I tried to find issue using
pl < Localizable.strings
But again I got file text printed with no error mentioned, then I tried a trick and it worked for me.
Right click on the Localizable.strings file
Then select option Open As option
Then select option ASCII Property List
That's it, XCode shows me the issue with line number and the issue was I had this DéjàVerified text as key on specified line, this helps me to identify and solve the issue, I hope it will save someone's time.
Cheers!
There can be multiple reasons for this:
Semicolon is missing at the end.
Multiple semicolons at the end.
" within the message which should be escaped by \".
Extra character after semicolon.
Invalid white space in the file.
Other invalid characters in the file.
Merge conflict characters in the file!
<<<<<<< HEAD, ======= and >>>>>>>.
Please note that plutil -lint Localizable.strings returned OK for point-2 & 7!
In my case, I was missing "=" between a string pair. Even plutil did not help me to spot the error line. I manually checked each string pair. :/
Your syntax seems to be fine, the only thing that I can see can "break" your file and cause this error is the quote character. Make sure to use the reqular one " and not in any other form like ″ for example.
Also make sure the strings file name is always Localizable.strings
I Had the same issue and i resolved it by commenting or removed unused strings in my Localizable.String file :)
I once had a similar error and it turned out that there was an URL in the middle of the file, like this:
// Some Comment 1
"Some key 1" = "Some value 1";
http://...whatever...
// Some Comment 2
"Some key 2" = "Some value 2";
When calling plutil -lint on that file the output was:
Unexpected character / at line 1
Well, the first character indeed was / as the file started with a comment but the problem resolved after removing the URL; or turning it into a comment which it actually should have been. Note that the URL was nowhere near the beginning of the strings file, it was about in the middle of a 6000 lines string file. I was only able to find it by browsing through commit history and always look at the changes.
if missing ";" at end of the all lines in Localizable.string file, this error can occur.
eg :-
"header_text" = "Current Language";
"change_language" = "Change Language";
"header_text" = "වත්මන් භාෂාව";
"change_language" = "භාෂාව වෙනස් කරන්න";
This may be because the translation file format is wrong.
You can download a mac software called Localizable.
This is the download link: https://apps.apple.com/cn/app/localizable-%E7%BF%BB%E8%AF%91%E6%96%87%E4%BB%B6%E5%B7%A5%E5%85%B7/id1268616588?mt=12,
you only need to drag Localizable.strings to the software and it will It is useful to tell you which line in the file may have a problem. It saved me a lot of time. Now I share it with you.
I hope it will be helpful to you.
It seems your info.plist is not in correct form . check it properly. I also had the same issue . I resolved it by modifying my info.plist.
I just had this experience:
external translator doing the work inside Visual Code or other text editors
Files not working and getting an error like this one: ( testing with plutil -lint )
Localizable.strings: Unexpected character " at line 1
CardRatingView.strings: Unexpected character / at line 2
I just created a new file within XCode and copy pasted all the file content and suddenly everything was working properly.
I guess something can go wrong / corrupting the file itself while working with other text editors.
If showing something like Unexpected character " at line 1, and it is the first string like "app_name"="Any Name"
Check that the file is UTF16
I ran into this issue, all my formatting was correct. Checking for illegal characters using plutil -lint Localizable.strings and using ruby libraries like "utf8_utils" also didn't work at finding the illegal characters. BUT when I pasted the Localizable.strings contents into the Terminal app while running irb, it did show me the weird characters.
"PercentComplete" = "%d procent gennemført";
Pasted into irb:
"PercentComplete"\U+FFC2\U+FFA0= "%d procent gennemf\U+FFC3\U+FFB8rt";
Then all I had to do was a regex replace to fix those weird white space characters: \U+FFC2\U+FFA0
Thanks to the plutil suggestion I understood that to make it work you have to delete also any \ or * as are not read as comments and, important, add a ; to the end of the file. Xcode 11.5.
If pl and plutil show no problems, check the file's encoding. I had a similar problem twice and in my case it was due to incorrect encoding, though I have no idea how it has been changed (I literally added a single line in the middle of the file in X-Code). Converting from UTF-16LE to UTF-16BE in some editor (I used Android Studio) fixed the problem.
For me I had an NSLocalizedString in my code that contained a string interpolation e.g. NSLocalizedString("\(product.price ?? "")per_month"). When I exported localisations this got added to my strings file, which was then in the wrong format. It threw me off because my strings file in Xcode looked fine, but actually the file gets updated as part of the export localisations process, and errors were creeping in there.
If anyone things they might be having the same issue try calling genstrings separately and seeing if the newly generated file is in the correct format. Make sure you save your strings first as this will overwrite your strings file : find ./ -name "*.swift" -print0 | xargs -0 genstrings -SwiftUI -o en.lproj
This tool can help solve this problem, just select your localizable.strings file, it will help you find out which line format is wrong, it can save a lot of time
https://localizable.appdevtool.io/
In my case, I had one line with using ” instead of " and that breaks the file. My code editor did not detect this difference.
I was having the similar issue where i didn't escape the string value with backslash \ for one of my string's value.
Before:
"INVALID_NUMBER" = "It seems you're entering invalid number. Number should starts with "0" or "7"";
Updated:
"INVALID_NUMBER" = "It seems you're entering invalid number. Number should starts with \"0\" or \"7\"";
Backslashes are required when you want to display the quotation marks "
Please, have a quick look at here for How to include Quotation mark in strings
It seems like SVN is having some issue with this file. As it consider it to be a binary file. It is inserting a lot of non printable characters between each characters. I still couldn't find a proper solution. Just changing the Localizable.string files from production PC for avoiding any issue with it.
Update: Updating the SVN client (smartSVN) to the latest version solved the issue. It seems one of my colleague was using a older version. When he commited the change to localizable file it caused the error.
I make pdf in org-mode with my own preamble, but the PDF or tex file generated always appear the information resulting from:
(format "\\hypersetup{\n pdfkeywords={%s},\n pdfsubject={%s},\n pdfcreator={%s}}\n"
(org-export-latex-fontify-headline keywords)
(org-export-latex-fontify-headline description)
(concat "Emacs Org-mode version " org-version))
those cods locate in ~/.emacs.d/org-7.8.11/lisp/org-latex.el
I cancelled it to prevent the useless information appearing at the first page of its PDF-file.
However is it OK to delete such codes without any function lost?
what influences will be caused by this action?
Thank you for your help.
Ok, I know how it is.
add the code into your preamble :
\usepackage{hyperref}
all are solved.
In that same file you mention, (lisp/org-latex.el), it suggests
org-latex-hyperref-template...
Set it to the empty string to ignore the command completely.
So the following should work
(setq org-latex-hyperref-template "")
Alas, I've reading downloaded source code not the same as my current org version, so this didn't work. apropos may be an easy fix, so
M-x apropos RET hyperref RET
leads me to the variable org-latex-with-hyperref, so now I try
(setq org-latex-with-hyperref nil)
This worked for me.
I have a relatively complicated suite of OMake files designed for cross-compiling on a specific platform. My source is in C++.
I'm building from Windows and I need to pass to the compiler include directories which have spaces in their names. The way that the includes string which is inserted in the command line to compile files is created is by the line:
public.PREFIXED_INCLUDES = $`(addprefix $(INCLUDES_OPT), $(set $(absname $(INCLUDES))))
At some other point in the OMake files I have a line like:
INCLUDES += $(dir "$(LIBRARY_LOCATION)/Path with spaces/include")
In the middle of the command line this expands to:
-IC:\Library location with spaces\Path with spaces\include
I want it to expand to:
-I"C:\Library location with spaces\Path with spaces\include"
I don't want to change anything but the "INCLUDES += ..." line if possible, although modifying something else in that file is also fine. I don't want to have to do something like change the definition of PREFIXED_INCLUDES, as that's in a suite of OMake files which are part of an SDK which may change beneath me. Is this possible? If so, how can I do it? If not, in what ways can I make sure that includes with spaces in them are quoted by modifying little makefile code (hopefully one line)?
The standard library function quote adds escaped quotes around its argument, so it should do the job:
INCLUDES += $(quote $(dir "$(LIBRARY_LOCATION)/Path with spaces/include"))
If needed, see quote in Omake manual.
In case someone else is having the same problem, I thought I'd share the solution I eventually went with, having never figured out how to surround with quotes. Instead of putting quotes around a name with spaces in it I ended up converting the path to the short (8.3) version. I did this via a a simple JScript file called shorten.js and a one line OMake function.
The script:
// Get Access to the file system.
var FileSystemObject = WScript.CreateObject("Scripting.FileSystemObject");
// Get the short path.
var shortPath = FileSystemObject.GetFolder(WScript.Arguments(0)).ShortPath;
// Output short path.
WScript.StdOut.Write(shortPath);
The function:
ShortDirectoryPath(longPath) =
return $(dir $(shell cscript /Nologo $(dir ./tools/shorten.js) "$(absname $(longPath))"))
So now I just use a line like the following for includes:
INCLUDES += $(ShortDirectoryPath $(dir "$(LIBRARY_LOCATION)/Path with spaces/include"))
I'm trying to find documentation that describe the syntax and possibilities suggested by the construction ${PRODUCT_NAME:rfc1034identifier}. Obviously this turns into some version of the product name, but where is the documentation that describes how? I just grepped the entire /Developer directory, and got nothing useful.
I'm not looking for the narrow definition of what happens to this particular variable, I want to know about all such modifiers like rfc1034identifier.
By using strings I also dug out the following things that look like they're related to :rfc1034identifier:
:quote - adds backslashes before whitespaces (and more), for use in shell scripts
:identifier - replaces whitespace, slashes (and more) with underscores
:rfc1034identifier - replaces whitespace, slashes (and more) with dashes
:dir - don't know, observed replace with ./ in some cases
:abs - don't know
Exact command:
strings /Developer/Library/PrivateFrameworks/DevToolsCore.framework/Versions/A/DevToolsCore|grep '^:'
There are more things that look like interesting modifiers (for example, :char-range=%#), but I couldn't get these to work. There's only one example of :char-range on the net, and it's from a crash log for Xcode.
Someone asked how do we know it's a modifier specification. Well, we know because it works on multiple variables in build settings. Plist preprocessor probably uses the same mechanisms to resolve build variables as does the build system.
Hack Saw, if you get a response via that bug report, don't forget to keep us informed :-)
Looks like you can stack these as well. The useful case floating around out there is
com.yourcompany.${PRODUCT_NAME:rfc1034identifier:lower}
such that a product name of "Your App" becomes com.yourcompany.your-app.
At long last, Apple produced some documentation on this. This is in the "Text Macros" section of the Xcode manual, as of this date.
Text macro format reference
A text macro can contain any valid unicode text. It can also contain other text macros.
Including other text macros
To include another text macro, add three underscore (_) characters before and after the macro name:
___<MacroName>___
Modifying text macro expansion
You can modify the final expansion of the text macro by adding one or more modifiers. Add a modifier to a text macro by placing a colon (:) at the end of the macro followed by the modifier. Add multiple modifiers by separating each one with a comma (,).
<MACRO>:<modifier>[,<modifier>]…
For example, the following macro will remove the path extension from the FILENAME macro:
FILENAME:deletingPathExtension
To turn the modified macro above into a valid C identifier, add the identifier macro:
FILENAME:deletingPathExtension,identifier
Modifiers
bundleIdentifier: Replaces any non-bundle identifier characters with a hyphen (-).
deletingLastPathComponent: Removes the last path component from the expansion string.
deletingPathExtension: Removes any path extension from the expansion string.
deletingTrailingDot: Removes any trailing dots (.).
identifier: Replaces any non-C identifier characters with an underscore (_).
lastPathComponent: Returns just the last path component of the expansion string.
pathExtension: Returns the path extension of the expansion string.
rfc1034Identifier: Replaces any non-rfc1034 identifier characters with a hyphen (-).
xml: Replaces special xml characters with the corresponding escape string. For example, less-than (<) is replaced with <
TEXT MACROS
Text macros reference
COPYRIGHT
A copyright string that uses the company name of the team for the project. If there is no company name, the string is blank.
The example shows a copyright string when the company is set to “Apple”.
Copyright © 2018 Apple. All rights reserved.
DATE
The current date.
DEFAULTTOOLCHAINSWIFTVERSION
The version of Swift used for the default toolchain.
FILEBASENAME
The name of the current file without any extension.
FILEBASENAMEASIDENTIFIER
The name of the current file encoded as a C identifier.
FILEHEADER
The text placed at the top of every new text file.
FILENAME
The full name of the current file.
FULLUSERNAME
The full name of the current macOS user.
NSHUMANREADABLECOPYRIGHTPLIST
The entry for the human readable copyright string in the Info.plist file of a macOS app target. The value of the macro must include the XML delimiters for the plist. For example, a valid value is:
'''
<key>NSHumanReadableCopyright</key>
<string>Copyright © 2018 Apple, Inc. All rights reserved.</string>
'''
Notice that the value includes a newline.
ORGANIZATIONNAME
The name for your organization that appears in boilerplate text throughout your project folder. The organization name in your project isn’t the same as the organization name that you enter in App Store Connect.
PACKAGENAME
The name of the package built by the current scheme.
PACKAGENAMEASIDENTIFIER
A C-identifier encoded version of the package name built by the current scheme.
PRODUCTNAME
The app name of the product built by the current scheme.
PROJECTNAME
The name of the current project.
RUNNINGMACOSVERSION
The version of macOS that is running Xcode.
TARGETNAME
The name of the current target.
TIME
The current time.
USERNAME
The login name for the current macOS user.
UUID
Returns a unique ID. The first time this macro is used, it generates the ID before returning it. You can use this macro to create multiple unique IDs by using a modifier. Each modifier returns an ID that is unique for that modifier. For example, the first time the UUID:firstPurpose modifier is used, the macro generates and returns a unique ID for that macro and modifier combination. Subsequent uses of the UUID:firstPurpose modifier return the same ID. Adding the UUID:secondPurpose modifier generates and returns a different ID that will be unique to UUID:secondPurpose, and different from the ID for UUID:firstPurpose.
WORKSPACENAME
The name of the current workspace. If there is only one project open, then the name of the current project.
YEAR
The current year as a four-digit number.
$ strings /Developer/Library/PrivateFrameworks/DevToolsCore.framework/Versions/A/DevToolsCore
PRODUCTNAME
PRODUCTNAMEASIDENTIFIER
PRODUCTNAMEASRFC1034IDENTIFIER
PRODUCTNAMEASXML
It seems that there are :identifier, :rfc1034identifier and :xml modifiers. But I have no clue except this.
After stumbling over this question and its existing answers, I have to say: Apples documentation did not improve on this topic over the recent years. We are currently at Xcode 13 and there is still no complete list of all modifiers available.
Therefore I did some spelunking and found the supported modifiers in DVTFoundation.framework which I will list below.
I've tested them all in Xcode 13.3 build settings and used the following two macros to illustrate their impact:
MY_MACRO = Some "text" with umlauts äöüçñ and special characters are ',/|\-_:;%&<>.!
MY_SOURCE = /Applications/Xcode.app/Contents/Frameworks/../SharedFrameworks/DVTFoundation.framework
Retrieval operators/modifiers
Retrieval modifiers are used to extract and/or transform all or parts of a macro/variable/setting.
They are applied using the following syntax: $(<VARIABLE>:<MODIFIER>)
quote: Escapes all characters which have a special meaning in shell scripts/commands like space, colon, semicolon and backslash.
RESULT_quote = $(MY_MACRO:quote)
Some\ \"text\"\ with\ umlauts\ äöüçñ\ and\ special\ characters\ are\ \',/|\\-_:;%&<>.!
upper: Transforms all characters to their uppercase equivalents.
RESULT_upper = $(MY_MACRO:upper)
SOME "TEXT" WITH UMLAUTS ÄÖÜÇÑ AND SPECIAL CHARACTERS ARE ',/|\-_:;%&<>.!
lower: Transforms all characters to their lowercase equivalents.
RESULT_lower = $(MY_MACRO:lower)
some "text" with umlauts äöüçñ and special characters are ',/|\-_:;%&<>.!
identifier: Replaces any non-C identifier characters with an underscore (_).
RESULT_identifier = $(MY_MACRO:identifier)
Some__text__with_umlauts_______and_special_characters_are________________
rfc1034identifier: Replaces any non-rfc1034 identifier characters with a hyphen (-)
RESULT_rfc1034identifier = $(MY_MACRO:rfc1034identifier)
Some--text--with-umlauts-------and-special-characters-are----------------------------
c99extidentifier: Replaces any non-C99 identifier characters with an underscore (_). Umlauts are allowed as C99 uses Unicode!
RESULT_c99extidentifier = $(MY_MACRO:c99extidentifier)
Some__text__with_umlauts_äöüçñ_and_special_characters_are___________________________
xml: According to Apple documentation it should replace special xml characters with the corresponding escape string. For example, less-than (<) is replaced with <. But in my examples this didn't work.
RESULT_xml = $(MY_MACRO:xml)
Some "text" with umlauts äöüçñ and special characters are ',/|\-_:;%&<>.!
dir: Extracts the directory part of a path
RESULT_dir = $(MY_SOURCE:dir)
/Applications/Xcode.app/Contents/Frameworks/../SharedFrameworks/
file: Extracts the filename part of a path
RESULT_file = $(MY_SOURCE:file)
DVTFoundation.framework
base: Extracts the filename base part of a path (=filename without suffix/extension)
RESULT_base = $(MY_SOURCE:base)
DVTFoundation
suffix: Extracts the filename extension/suffix a path or filename
RESULT_suffix = $(MY_SOURCE:suffix)
.framework
standardizepath: Standardizes the path (e.g. ../ and tilde (~) are resolved)
RESULT_standardizepath = $(MY_SOURCE:standardizepath)
/Applications/Xcode.app/Contents/SharedFrameworks/DVTFoundation.framework
Replacement operators/modifiers
Beside above extracting/transforming operators, there is support built into the build settings system to replace specific parts of a directory which are matched using a modifier.
They are applied using the following syntax: $(<VARIABLE>:<MODIFIER>=<VALUE>)
dir=<VALUE>: Replaces the directory part of a path with <VALUE> and returns the new path
RESULT2_dir = $(MY_SOURCE:dir=/Developer/SharedFrameworks)
/Developer/SharedFrameworks/DVTFoundation.framework
file=<VALUE>: Replaces the filename part of a path and returns the new path
RESULT2_file = $(MY_SOURCE:file=my_file.txt)
/Applications/Xcode.app/Contents/Frameworks/../SharedFrameworks/my_file.txt
base=<VALUE>: Replaces the filename base part of a path (=filename without suffix/extension) and returns the new path
RESULT2_base = $(MY_SOURCE:base=Dummy)
/Applications/Xcode.app/Contents/Frameworks/../SharedFrameworks/Dummy.framework
suffix=<VALUE>: Replaces the filename extension/suffix a path and returns the new path
RESULT2_suffix = $(MY_SOURCE:suffix=.txt)
/Applications/Xcode.app/Contents/Frameworks/../SharedFrameworks/DVTFoundation.txt
I hope this list will help more people looking at Xcodes build settings and wondering how they can be transformed.
When using the MnSymbol package, pdflatex gives two font warnings:
LaTeX Font Warning: Encoding 'OMS' has changed to 'U' for symbol font
(Font) 'symbols' in the math version 'normal' on input line 120.
LaTeX Font Info: Overwriting symbol font 'symbols' in version 'normal'
(Font) OMS/cmsy/m/n --> U/MnSymbolF/m/n on input line 120.
It turns out that this is probably due to a clash with the AMSSymb package.
Since I need just a few symbols from the package: is there a way to load one symbol from a package, in stead of all?
Here's how I solved this:
Download the perl script "makefakeMnSymbol" from the comprehensive latex symbol document source:
http://mirror.ctan.org/info/symbols/comprehensive/source/makefakeMnSymbol
Next, at command line do chmod +x makefakeMnSymbol to make it executable. Then, run
./makefakeMnSymbol `kpsewhich MnSymbol.sty` > fakeMnSymbol.sty
Put fakeMnSymbol.sty in a texmf directory of choice (global or local), and run texhash
If you now put
\usepackage{fakeMnSymbol}
in your preamble, you can now use any MnSymbol, like \powerset by prefixing it like \MNSpowerset
Big thanks to Scott Pakin for this hack... and for his comprehensive symbol guide...
This hack has problems with symbols in subscripts/superscripts. A work-around is to use look at the fakeMnSymbol.sty source to find which font the symbol you want was loaded from, along with its number. Here's an example from one of my preambles where I override the built-in \boxminus with an MnSymbol:
\usepackage[]{fakeMnSymbol}
\DeclareSymbolFont{mnsymbolc}{U}{MnSymbolC}{m}{n}
\let\boxminus=\undefined
\DeclareMathSymbol{\boxminus}{2}{mnsymbolc}{112}
These warnings are nothing to worry about. In fact, in the next LaTeX release they'll disappear (see the original bug report). No ETA on that, however.
Moreover, is there any real chance this affects the typesetting of the document?
Nope.
is there any way to prevent this?
Can patch the LaTeX warning message code before loading the package, and then restore it again afterwards (this is what I've done in the past in my own packages), but as a user I'd just learn to ignore the warning.
The following might help. This is the code I had to add in order to get just the \bigominus symbol out of the MnSymbol package.
\DeclareFontFamily{U}{MnSymbolF}{}<br>
\DeclareSymbolFont{mnsymbols}{U}{MnSymbolF}{m}{n}<br>
\DeclareFontShape{U}{MnSymbolF}{m}{n}{<br>
<-6> MnSymbolF5<br>
<6-7> MnSymbolF6<br>
<7-8> MnSymbolF7<br>
<8-9> MnSymbolF8<br>
<9-10> MnSymbolF9<br>
<10-12> MnSymbolF10<br>
<12-> MnSymbolF12}{}<br>
\DeclareMathSymbol{\bigominus}{\mathop}{mnsymbols}{55}